Intra prediction-based video encoding/decoding method and device

ABSTRACT

A video encoding/decoding method and device according to the present invention may: determine a reference area for the intra prediction of the current block; derive the intra prediction mode of the current block; and decode the current block on the basis of the reference area and the intra prediction mode.

CROSS REFERENCE TO RELATED APPLICATIONS

This Application is a continuation of U.S. patent application Ser. No.17/079,784 filed on Oct. 26, 2020, which pursuant to 35 U.S.C. §§ 120and 365(c), is a Bypass Continuation of International Application No.PCT/KR2019/018740, filed on Dec. 30, 2019, which claims the benefitunder 35 U.S.C. §§ 119(a) and 365(b) of Korean Patent Application No.10-2018-0173164, filed on Dec. 28, 2018, and Korean Patent ApplicationNo. 10-2018-0173228, filed on Dec. 29, 2018 in the Korean IntellectualProperty Office, the entire disclosure of which is incorporated hereinby reference for all purposes.

TECHNICAL FIELD

The present invention relates to a video encoding/decoding method andapparatus.

BACKGROUND ART

Recently, demand for high-resolution and high-quality images such ashigh definition (HD) images and ultra high definition (UHD) images isincreasing in various application fields, and accordingly,high-efficiency image compression techniques are being discussed.

Various technologies exist, such as the inter prediction technology thatpredicts pixel values included in a current picture from a picturebefore or after a current picture using video compression technology,the intra prediction technology that predicts pixel values included in acurrent picture by using pixel information in a current picture, anentropy encoding technology that allocates a short code to a value witha high frequency of appearance and a long code to a value with a lowfrequency of appearance. Image data can be effectively compressed byusing such image compression technology, and transmitted or stored.

DISCLOSURE Technical Problem

An object of the present invention is to provide an efficient blockdivision method and apparatus.

An object of the present invention is to provide a method and anapparatus for deriving an intra prediction mode.

An object of the present invention is to provide a method and anapparatus for determining a reference region for intra prediction.

An object of the present invention is to provide an intra predictionmethod and apparatus according to a component type.

Technical Solution

A method and an apparatus of encoding/decoding an image of the presentinvention may determine a reference region for intra prediction of acurrent block, derive an intra prediction mode of the current block, anddecode the current block based on the reference region and the intraprediction mode.

In the method and apparatus of encoding/decoding the image of thepresent invention, the intra prediction modes pre-defined in theencoding/decoding apparatus may be divided into an MPM candidate groupand a non-MPM candidate group, and the MPM candidate group may includeat least one of a first candidate group or a second candidate group.

In the method and apparatus of encoding/decoding the image of thepresent invention, the intra prediction mode of the current block may bederived from either the first candidate group or the second candidategroup.

In the method and apparatus of encoding/decoding the image of thepresent invention, the first candidate group may be composed of adefault mode pre-defined in the decoding apparatus, and the secondcandidate group may be composed of a plurality of MPM candidates.

In the method and apparatus of encoding/decoding the image of thepresent invention, the default mode may be at least one of a planarmode, a DC mode, a vertical mode, a horizontal mode, a vertical mode, ora diagonal mode.

In the method and apparatus of encoding/decoding the image of thepresent invention, the plurality of MPM candidates may include at leastone of an intra prediction mode of a neighboring block, a mode obtainedby subtracting n value from the intra prediction mode of the neighboringblock, or a mode obtained by adding n value to the intra prediction modeof the neighboring block. Herein, n may mean a natural number of 1, 2,or more.

In the method and apparatus of encoding/decoding the image of thepresent invention, the plurality of MPM candidates may include at leastone of a DC mode, a vertical mode, a horizontal mode, a mode obtained bysubtracting or adding m value to the vertical mode, or a mode obtainedby subtracting or adding m value to the horizontal mode. Herein, m maybe a natural number of 1, 2, 3, 4 or more.

In the method and apparatus of encoding/decoding the image of thepresent invention, the encoding apparatus may determine a candidategroup to which the intra prediction mode of the current block belongs,encode a flag for identifying the candidate group, and the decodingapparatus may select one of the first candidate group or the secondcandidate group based on a flag signaled from the encoding apparatus.

In the method and apparatus of encoding/decoding the image of thepresent invention, the derived intra prediction mode may be changed byapplying a predetermined offset to the derived intra prediction mode.

In the method and apparatus of encoding/decoding the image of thepresent invention, the application of the offset may be selectivelyperformed based on at least one of a size, shape, split information, avalue of the intra prediction mode, or component type of the currentblock.

In the method and apparatus of encoding/decoding the image of thepresent invention, determining the reference region may includesearching for an unavailable pixel belonging to the reference region andreplacing the unavailable pixel with an available pixel.

In the method and apparatus of encoding/decoding the image of thepresent invention, the available pixel may be determined based on a bitdepth value or may be a pixel adjacent to at least one of a left, right,top, or bottom of the unavailable pixel.

Advantageous Effects

The present invention may improve the efficiency of intra predictionencoding/decoding through adaptive block division.

According to the present invention, prediction may be more accuratelyand efficiently performed by deriving an intra prediction mode based onan MPM candidate group.

According to the present invention, in the case of a chroma block, bydefining an inter-components reference-based prediction mode as aseparate group, the intra prediction mode derivation of the chroma blockmay be more efficiently performed.

According to the present invention, accuracy and efficiency of intraprediction may be improved by replacing unavailable pixels in areference region for intra prediction with predetermined availablepixels.

According to the present invention, the efficiency of inter predictionmay be improved based on inter-components reference.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing an image encoding apparatus accordingto an embodiment of the present invention.

FIG. 2 is a block diagram showing an image decoding apparatus accordingto an embodiment of the present invention.

FIG. 3 illustrates a method of dividing a picture into a plurality offragment regions as an embodiment to which the present invention isapplied.

FIG. 4 is an exemplary diagram illustrating an intra prediction modepre-defined in an image encoding/decoding apparatus as an embodiment towhich the present invention is applied.

FIG. 5 illustrates a method of decoding a current block based on intraprediction as an embodiment to which the present invention is applied.

FIG. 6 illustrates a method of replacing an unavailable pixel in areference region as an embodiment to which the present invention isapplied.

FIG. 7 illustrates a method of changing/correcting an intra predictionmode as an embodiment to which the present invention is applied.

FIG. 8 illustrates an inter-components reference-based prediction methodas an embodiment to which the present invention is applied.

FIG. 9 illustrates a method of configuring a reference region as anembodiment to which the present invention is applied.

FIG. 10 is an exemplary diagram for configuring an intra prediction modeset step by step as an embodiment to which the present invention isapplied.

FIGS. 11A-11D illustrates a method of classifying intra prediction modesinto a plurality of candidate groups as an embodiment to which thepresent invention is applied.

FIG. 12 is an exemplary diagram illustrating a current block and a pixeladjacent thereto as an embodiment to which the present invention isapplied.

FIG. 13 illustrates a method of performing intra prediction step by stepas an embodiment to which the present invention is applied.

FIG. 14 is an exemplary diagram for an arbitrary pixel for intraprediction as an embodiment to which the present invention is applied.

FIG. 15 is an exemplary diagram of dividing into a plurality ofsub-regions based on an arbitrary pixel as an embodiment to which thepresent invention is applied.

BEST MODE FOR INVENTION

A method and an apparatus of encoding/decoding an image of the presentinvention may determine a reference region for intra prediction of acurrent block, derive an intra prediction mode of the current block, anddecode the current block based on the reference region and the intraprediction mode.

In the method and apparatus of encoding/decoding the image of thepresent invention, the intra prediction modes pre-defined in theencoding/decoding apparatus may be divided into an MPM candidate groupand a non-MPM candidate group, and the MPM candidate group may includeat least one of a first candidate group or a second candidate group.

In the method and apparatus of encoding/decoding the image of thepresent invention, the intra prediction mode of the current block may bederived from either the first candidate group or the second candidategroup.

In the method and apparatus of encoding/decoding the image of thepresent invention, the first candidate group may be composed of adefault mode pre-defined in the decoding apparatus, and the secondcandidate group may be composed of a plurality of MPM candidates.

In the method and apparatus of encoding/decoding the image of thepresent invention, the default mode may be at least one of a planarmode, a DC mode, a vertical mode, a horizontal mode, a vertical mode, ora diagonal mode.

In the method and apparatus of encoding/decoding the image of thepresent invention, the plurality of MPM candidates may include at leastone of an intra prediction mode of a neighboring block, a mode obtainedby subtracting n value from the intra prediction mode of the neighboringblock, or a mode obtained by adding n value to the intra prediction modeof the neighboring block. Herein, n may mean a natural number of 1, 2,or more.

In the method and apparatus of encoding/decoding the image of thepresent invention, the plurality of MPM candidates may include at leastone of a DC mode, a vertical mode, a horizontal mode, a mode obtained bysubtracting or adding m value to the vertical mode, or a mode obtainedby subtracting or adding m value to the horizontal mode. Herein, m maybe a natural number of 1, 2, 3, 4 or more.

In the method and apparatus of encoding/decoding the image of thepresent invention, the encoding apparatus may determine a candidategroup to which the intra prediction mode of the current block belongs,encode a flag for identifying the candidate group, and the decodingapparatus may select one of the first candidate group or the secondcandidate group based on a flag signaled from the encoding apparatus.

In the method and apparatus of encoding/decoding the image of thepresent invention, the derived intra prediction mode may be changed byapplying a predetermined offset to the derived intra prediction mode.

In the method and apparatus of encoding/decoding the image of thepresent invention, the application of the offset may be selectivelyperformed based on at least one of a size, shape, split information, avalue of the intra prediction mode, or component type of the currentblock.

In the method and apparatus of encoding/decoding the image of thepresent invention, determining the reference region may includesearching for an unavailable pixel belonging to the reference region andreplacing the unavailable pixel with an available pixel.

In the method and apparatus of encoding/decoding the image of thepresent invention, the available pixel may be determined based on a bitdepth value or may be a pixel adjacent to at least one of a left, right,top, or bottom of the unavailable pixel.

MODE FOR INVENTION

The present invention may be changed and modified variously and beillustrated with reference to different exemplary embodiments, some ofwhich will be described and shown in the drawings. However, theseembodiments are not intended for limiting the invention but areconstrued as including includes all modifications, equivalents andreplacements which belong to the spirit and technical scope of theinvention. Like reference numerals in the drawings refer to likeelements throughout.

Although the terms first, second, etc. may be used to describe variouselements, these elements should not be limited by these terms. Theseterms are used only to distinguish one element from another element. Forexample, a first element could be termed a second element and a secondelement could be termed a first element likewise without departing fromthe teachings of the present invention. The term “and/or” includes anyand all combinations of a plurality of associated listed items.

It will be understood that when an element is referred to as being“connected to” or “coupled to” another element, the element can bedirectly connected or coupled to another element or interveningelements. On the contrary, when an element is referred to as being“directly connected to” or “directly coupled to” another element, thereare no intervening elements present.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a,” “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “include” and/or“have,” when used in this specification, specify the presence of statedfeatures, integers, steps, operations, elements, and/or components, butdo not preclude the presence or addition of one or more other features,integers, steps, operations, elements, components, and/or groupsthereof.

Hereinafter, exemplary embodiments of the invention will be described indetail with reference to the accompanying drawings. Like referencenumerals in the drawings refer to like elements throughout, andredundant descriptions of like elements will be omitted herein.

FIG. 1 is a block diagram illustrating an image encoding apparatusaccording to an embodiment of the present invention.

Referring to FIG. 1 , the image encoding apparatus 100 includes apicture dividing unit 110, prediction units 120 and 125, a transformunit 130, a quantization unit 135, a reordering unit 160, an entropyencoding unit 165, an inverse quantization unit 140, an inversetransform unit 145, a filter unit 150, and a memory 155.

Each of the elements shown in FIG. 1 is shown independently to representdifferent characteristic functions in the encoding apparatus, and doesnot mean that each element is made up of separate hardware or onesoftware element. That is, the elements are independently arranged forconvenience of description, wherein at least two elements may becombined into a single element, or a single element may be divided intoa plurality of elements to perform functions. It is to be noted thatembodiments in which some elements are integrated into one combinedelement and/or an element is divided into multiple separate elements areincluded in the scope of the present invention without departing fromthe essence of the present invention.

Some elements are not essential to the substantial functions in theinvention and may be optional constituents for merely improvingperformance. The invention may be embodied by including onlyconstituents essential to embodiment of the invention, except forconstituents used to merely improve performance. The structure includingonly the essential constituents except for the optical constituents usedto merely improve performance belongs to the scope of the invention.

The picture dividing unit 110 may divide the input picture into at leastone processing unit. In this case, the processing unit may be aprediction unit (PU), a transform unit (TU), or a coding unit (CU). Thepicture dividing unit 110 may divide one picture into a plurality ofcombinations of a coding unit, a prediction unit, and a transformationunit, and select one combination of a coding unit, a prediction unit,and a transformation unit based on a predetermined criterion (forexample, a cost function) to encode the picture.

For example, one picture may be divided into a plurality of codingunits. In order to divide a picture into the coding units, a recursivetree structure such as a quad tree structure may be used. One image, amaximum coding block (largest coding unit) or a coding tree unit (CTU)as a root may be divided into other coding units, and may be dividedwith as many child nodes as the number of divided coding units. A codingunit that are no longer divided according to certain restrictions becomea leaf node. That is, when it is assumed that only square division ispossible for one coding unit, one coding unit may be divided into up tofour different coding units.

In the embodiments of the invention, a coding unit may be used to referto not only a unit of encoding but also a unit of decoding.

The prediction unit may be a block divided in a shape such as at leastone square or rectangle of the same size within one coding unit, or oneprediction unit among the prediction units divided within one codingunit may have a different shape and/or size from another predictionunit.

When a prediction unit that performs intra prediction based on a codingunit is not a minimum coding unit, intra prediction may be performedwithout dividing into a plurality of prediction units N×N.

The prediction units 120 and 125 may include an inter prediction unit120 to perform inter prediction and an intra prediction unit 125 toperform intra prediction. The prediction units 120 and 125 may determinewhich of inter prediction and intra prediction is performed on a PU, andmay determine specific information (for example, an intra predictionmode, a motion vector, and a reference picture) of the determinedprediction method. Here, a processing unit on which prediction isperformed may be different from a processing unit for which a predictionmethod and specific information thereon are determined. For example, aprediction method and a prediction mode may be determined for each PU,while prediction may be performed for each TU. A residual value(residual block) between a generated predicted block and an originalblock may be input to the transform unit 130. Further, prediction modeinformation, motion vector information and the like used for predictionmay be encoded along with the residual value by the entropy encodingunit 165 and be transmitted to the decoding apparatus. When a specificencoding mode is used, the original block may be encoded and transmittedto the decoding apparatus without generating a prediction block by theprediction units 120 and 125.

The inter prediction unit 120 may predict a PU based on information onat least one picture among a previous picture of a current picture and asubsequent picture of a current picture. In some cases, the interprediction unit 120 may predict a PU based on information of a partiallyencoded region in the current picture. The inter prediction unit 120 mayinclude a reference picture interpolation unit, a motion predictionunit, and a motion compensation unit.

The reference picture interpolation unit may be supplied with referencepicture information from the memory 155 and generate pixel informationless than or equal to an integer pixel on a reference picture. In thecase of luma pixels, a DCT-based 8-tap interpolation filter with avariable filter coefficient may be used to generate pixel informationless than or equal to an integer pixel in a unit of a ¼ pixel. In thecase of chrominance pixels, a DCT-based 4-tap interpolation filter witha variable filter coefficient may be used to generate pixel informationless than or equal to an integer pixel in a unit of a ⅛ pixel.

The motion prediction unit may perform motion prediction on the basis ofthe reference picture interpolated by the reference pictureinterpolation unit. Various methods, such as a full search-based blockmatching algorithm (FBMA), a three-step search (TSS) algorithm and a newthree-step search (NTS) algorithm, may be used to calculate a motionvector. A motion vector has a motion vector value in the unit of a ½ or¼ pixel on the basis of an interpolated pixel. The motion predictionunit may predict a current PU using different motion prediction methods.Various methods, such as skip mode, merge mode, advanced motion vectorprediction (AMVP) mode, and intra block copy mode, etc. may be used asthe motion prediction method.

The intra prediction unit 125 may generate a PU on the basis ofinformation on a reference pixel neighboring to a current block. When areference pixel is a pixel for which inter prediction has been performedbecause a block neighboring to the current PU is a block for which interprediction has been performed, information on a reference pixel in theblock for which inter prediction has been performed may be replaced withinformation on a reference pixel in a block for which intra predictionhas been performed. That is, when a reference pixel is not available,information on the unavailable reference pixel may be replaced withinformation on at least one reference pixel of the available referencepixels.

A prediction mode of intra prediction includes a directional predictionmode in which reference pixel information is used according to aprediction direction and a non-directional prediction mode in whichinformation on direction is not used in performing prediction. A modefor predicting luma information and a mode for predicting chromainformation may be different from each other. Further, intra predictionmode information used to predict luma information or the predicted lumasignal information may be used to predict chroma information.

When the size of the prediction unit and the size of the transform unitare the same in performing intra prediction, intra prediction for theprediction unit may be performed based on a pixel on the left, a pixelon the top-left, and a pixel on the top of the prediction unit. However,when the size of the prediction unit and the size of the transform unitare different in performing intra prediction, intra prediction may beperformed using a reference pixel determined based on the transformunit. Also, intra prediction using N×N division may be used for only theminimum coding unit.

In the intra prediction method, a predicted block may be generated byapplying an adaptive intra smoothing (AIS) filter to the referencepixels according to the prediction mode. Different types of AIS filtersmay be applied to the reference pixels. In the intra prediction method,the intra prediction mode of a current PU may be predicted from an intraprediction mode of a PU neighboring to the current PU. In predicting theprediction mode of the current PU using mode information predicted froma neighboring PU, when the current PU and the neighboring PU have thesame intra prediction mode, information indicating that the current PUand the neighboring PU have the same prediction mode may be transmittedusing predetermined flag information. When the current PU and theneighboring PU have different prediction modes, information on theprediction mode of the current block may be encoded by entropy encoding.

A residual block including residual information may be generated. Theresidual information is a difference between a predicted unit generatedby the prediction units 120 and 125 and an original block of theprediction unit. The generated residual block may be input to thetransform unit 130.

The transform unit 130 may transform the residual block including theresidual information between the predicted unit generated by theprediction units 120 and 125 and the original block by using a transformtype such as DCT (Discrete Cosine Transform), DST (Discrete SineTransform), or KLT. Whether to apply DCT, DST, or KLT to transform theresidual block may be determined based on intra prediction modeinformation of the prediction unit used to generate the residual block.

The quantization unit 135 may quantize values transformed into afrequency domain by the transform unit 130. A quantization coefficientmay be changed depending on a block or importance of an image. Valuesoutput from the quantization unit 135 may be provided to the inversequantization unit 140 and the rearrangement unit 160.

The rearrangement unit 160 may perform the rearrangement of thecoefficient values for the quantized residual.

The rearrangement unit 160 may change coefficients of a two-dimensional(2D) block into coefficients of a one-dimensional (1D) vector throughcoefficient scanning method. For example, the rearrangement unit 160 mayscan a DC coefficient to a coefficient in the high-frequency regionusing Zig-Zag scan method, and change it into a one-dimensional vectorform. Depending on the size of the transform unit and the intraprediction mode, instead of zig-zag scan, a vertical scan that scans atwo-dimensional block shape coefficient in a column direction and ahorizontal scan that scans a two-dimensional block shape coefficient ina row direction may be used. That is, according to the size of thetransform unit and the intra prediction mode, it is possible todetermine which of a zig-zag scan, a vertical direction scan, and ahorizontal direction scan is to be used.

The entropy encoding unit 165 may perform entropy encoding on the basisof the values obtained by the rearrangement unit 160. Various encodingmethods, such as exponential Golomb coding, context-adaptive variablelength coding (CAVLC), or context-adaptive binary arithmetic coding(CABAC), may be used for entropy encoding.

The entropy encoding unit 165 may encode a variety of information, suchas residual coefficient information and block type information of acoding unit, prediction mode information, division unit information,prediction unit information, transfer unit information, motion vectorinformation, reference frame information, block interpolationinformation and filtering information from the rearrangement unit 160and the prediction units 120 and 125.

The entropy encoding unit 165 may entropy-encode coefficients of a CUinput from the rearrangement unit 160.

The inverse quantization unit 140 and the inverse transform unit 145dequantize the values which are quantized by the quantization unit 135and inverse-transform the values which are transformed by the transformunit 130. A reconstructed block may be generated by adding the residualvalues to the predicted PU. The residual values may be generated by theinverse quantization unit 140 and the inverse transform unit 145. Thepredicted PU may be predicted by the motion vector prediction unit, themotion compensation unit, and the intra prediction unit of theprediction units 120 and 125.

The filter unit 150 may include at least one of a deblocking filter, anoffset unit, and an adaptive loop filter (ALF).

The deblocking filter may remove block distortion generated byboundaries between blocks in a reconstructed picture. Whether to applythe deblocking filter to a current block may be determined on the basisof pixels included in several rows or columns of the block. When thedeblocking filter is applied to a block, a strong filter or a weakfilter may be applied depending on a required deblocking filteringstrength. When horizontal filtering and vertical filtering are performedin applying the deblocking filter, the horizontal filtering and verticalfiltering may be performed in parallel.

The offset unit may apply the offset with respect to the original imageto the deblocking filtered image, in units of pixels. A region to whichthe offset may be applied may be determined after partitioning pixels ofa picture into a predetermined number of regions. The offset may beapplied to the determined region in consideration of edge information oneach pixel or the method of applying the offset to the determinedregion.

The ALF may perform filtering based on a comparison result of thefiltered reconstructed image and the original image. Pixels included inan image may be partitioned into predetermined groups, a filter to beapplied to each group may be determined, and differential filtering maybe performed for each group. Information on whether to apply the ALF maybe transferred by each coding unit and a shape and filter coefficientsof an ALF to be applied to each block may vary. Further, an ALF with thesame form (fixed form) may be applied to a block regardless ofcharacteristics of the block.

The memory 155 may store a reconstructed block or picture output fromthe filter unit 150, and the stored reconstructed block or picture maybe supplied to the prediction units 120 and 125 when performing interprediction.

FIG. 2 is a block diagram illustrating an image decoding apparatusaccording an exemplary embodiment of the present invention.

Referring to FIG. 2 , the image decoding apparatus 200 may include anentropy decoding unit 210, a rearrangement unit 215, a dequantizationunit 220, an inverse transform unit 225, prediction units 230 and 235, afilter unit 240, and a memory 245.

When an image bitstream is input from the image encoding apparatus, theinput bitstream may be decoded in a procedure opposite to that of theimage encoding apparatus.

The entropy decoding unit 210 may perform entropy decoding in aprocedure opposite to that of performing entropy encoding in an entropyencoding unit of an image encoding apparatus. For example, variousmethods, such as exponential Golomb coding, CAVLC or CABAC, may beapplied corresponding to the method performed by the image encodingapparatus.

The entropy decoding unit 210 may decode information associated withintra prediction and inter prediction performed by the encodingapparatus.

The rearrangement unit 215 may perform rearrangement on the bitstreamentropy-decoded by the entropy decoding unit 210 based on therearrangement method of the encoding apparatus. The rearrangement unit215 may reconstruct and rearrange coefficients of a 1D vector intocoefficients of a 2D block. The rearrangement unit 215 may be providedwith information on coefficient scanning performed by the encodingapparatus and may perform rearrangement using a method of inverselyscanning the coefficients, on the basis of scanning order performed bythe encoding apparatus.

The dequantization unit 220 may perform dequantization on the basis of aquantization parameter provided by the encoding apparatus and therearranged coefficients of the block.

The inverse transform unit 225 may perform an inverse transform, thatis, an inverse DCT, an inverse DST, and an inverse KLT, with respect tothe transform performed by the transform unit, that is, DCT, DST, andKLT on the quantization result performed by the image encodingapparatus. The inverse transform may be performed based on atransmission unit determined by the image encoding apparatus. Theinverse transform unit 225 of the image decoding apparatus mayselectively perform a transform technique (e.g., DCT, DST, KLT)according to a plurality of pieces of information such as a predictionmethod, a size of a current block, and a prediction direction.

The prediction units 230 and 235 may generate a prediction block on thebasis of information for generating prediction block and information ona previously-decoded block or picture provided. The information forgenerating prediction block may be provided from the entropy decodingunit 210. The information on a previously-decoded block or picture maybe provided from the memory 245.

As described above, when the size of the prediction unit and the size ofthe transform unit are the same when intra prediction is performed inthe same manner as the operation of the image encoding apparatus, intraprediction for the prediction unit may be performed based on a pixel onthe left, a pixel on the top-left, and a pixel on the top of theprediction unit. However, when the size of the prediction unit and thesize of the transform unit are different from each other when performingintra prediction, the intra prediction for the prediction unit may beperformed using a reference pixel determined based on the transformunit. In addition, intra prediction using N×N division may be used foronly the minimum coding unit.

The prediction units 230 and 235 may include a prediction unitdetermination unit, an inter prediction unit and an intra predictionunit. The prediction unit determination unit may receive a variety ofinformation, such as prediction unit information, prediction modeinformation of an intra prediction method and motion prediction-relatedinformation of an inter prediction method, etc. from the entropydecoding unit 210, may determine a prediction unit for a current codingunit. The prediction unit determination unit may determine which of theinter prediction and the intra prediction is performed on the predictionunit. An inter prediction unit 230 may perform inter prediction on acurrent prediction unit on the basis of information on at least onepicture among a previous picture and a subsequent picture of a currentpicture including the current prediction unit. Herein, an interprediction unit 230 may use information necessary for inter predictionfor the current prediction unit provided from the image encodingapparatus. The inter prediction may be performed on the basis of theinformation of the pre-reconstructed partial region in the currentpicture including the current prediction unit.

In order to perform inter prediction, it may be determined, in an unitof a coding unit, whether a motion prediction method for a predictionunit included in the coding unit is a skip mode, a merge mode, an AMVPmode or an intra block copy mode.

An intra prediction unit 235 may generate a prediction block on thebasis of pixel information in a current picture. When a prediction unitis a prediction unit for which intra prediction is performed, intraprediction may be performed based on intra prediction mode informationon the prediction unit provided from the image encoding apparatus. Theintra prediction unit 235 may include an AIS (Adaptive Intra Smoothing)filter, a reference pixel interpolation unit, and a DC filter. The AISfilter performs filtering on reference pixels of a current block. TheAIS filter may decide whether to apply the filter or not, depending on aprediction mode for the current prediction unit. AIS filtering may beperformed on the reference pixels of the current block using theprediction mode for the prediction unit and information on the AISfilter provided from the image encoding apparatus. When the predictionmode for the current block is a mode not performing AIS filtering, theAIS filter may not be applied.

When the prediction mode for the prediction unit indicates a predictionmode of performing intra prediction on the basis of pixel valuesobtained by interpolating the reference pixels, the reference pixelinterpolation unit may generate reference pixels in a unit of afractional pixel less than an integer pixel (i.e. full pixel) byinterpolating the reference pixels. When the prediction mode for thecurrent prediction unit indicates a prediction mode of generating aprediction block without interpolating the reference pixels, thereference pixels may not be interpolated. The DC filter may generate aprediction block through filtering when the prediction mode for thecurrent block is the DC mode.

The reconstructed block or picture may be provided to the filter unit240. The filter unit 240 includes a deblocking filter, an offset unit,and an ALF.

The image encoding apparatus may provide information on whether thedeblocking filter is applied to a corresponding block or picture, andinformation on which of a strong filter and a weak filter is appliedwhen the deblocking filter is used. The deblocking filter of the imagedecoding apparatus may be provided with information on the deblockingfilter from the image encoding apparatus and may perform deblockingfiltering on a corresponding block.

The offset unit may apply offset to the reconstructed picture on thebasis of information on an offset type and offset value applied to thepicture in the encoding process.

The ALF may be applied to a coding unit on the basis of information onwhether the ALF is applied and ALF coefficient information, etc.provided from the encoding apparatus. The ALF information may beincluded and provided in a specific parameter set.

The memory 245 may store the reconstructed picture or block for use as areference picture or a reference block and may provide the reconstructedpicture to an output unit.

In this specification, a coding unit, a coding block, a current block,and the like may be interpreted as the same meaning. An embodiment to bedescribed later may be performed by a corresponding unit of the imageencoding apparatus and/or the image decoding apparatus.

FIG. 3 illustrates a method of dividing a picture into a plurality offragment regions as an embodiment to which the present invention isapplied.

One picture may be divided into a predetermined fragment region. Thefragment region according to the present invention may include at leastone of a subpicture, a slice, a tile, a coding tree unit (CTU), or acoding unit (CU).

Referring to FIG. 3 , a picture 300 may include one or more subpictures.That is, a picture may be composed of one subpicture, or may be dividedinto a plurality of subpictures as shown in FIG. 3 .

In case of the subpicture, division information may be configureddifferently according to the encoding setting. (1) For example, asubpicture may be obtained in a batch division method based on avertical or horizontal line crossing the picture. (2) Alternatively, asubpicture may be obtained by a partial division method based on featureinformation (position, size, shape, etc., as for the shape describedlater, assuming a rectangular angle) of each subpicture.

(1) In the former case, division information of a subpicture may beconfigured based on the vertical or horizontal line that divide thesubpicture.

The line-based division may use either an uniform or non-uniformdivision. When the uniform method is used, information on the divisionnumber of each line may be generated, and when the non-uniform method isused, distance information (width or height) between lines may begenerated. Either an uniform or non-uniform division method may be useddepending on the encoding setting, or method selection information maybe explicitly generated. Uniform or non-uniform division method may beapplied collectively to vertical and horizontal lines. Alternatively,the methods applied to the vertical and horizontal lines is differentfrom each other. Information on the number of subpictures may be derivedbased on the division information.

The distance information between the lines may be encoded in units suchas n-sample units, CTU size, (2*CTU size), (4*CTU size), and the like.Here, n may be a natural number of 4, 8, 16, 32, 64, 128, 256 or more.The generated information may be signaled at least one level of a videoparameter set (VPS), a sequence parameter set (SPS), a picture parameterset (PPS), and a picture header (PH).

(2) In the latter case, position information of the subpicture (e.g.,information indicating the position of the top-left, top-right,bottom-left, and bottom-right of each subpicture), size information(e.g., information indicating width or height)), information on thenumber of subpictures, etc. may be used to configure divisioninformation of the subpicture.

Information specifying the number of subpictures (hereinafter, numberinformation) may be encoded by the encoding apparatus, and the decodingapparatus may determine the number of subpictures configuring onepicture based on the encoded number information. The number informationmay be signaled at least one level of VPS, SPS, PPS, and PH.Alternatively, the number information of subpictures may be implicitlyderived based on division information (position, size information, etc.)of the subpicture.

The information specifying the position of each subpicture (hereinafter,position information) may include an x-coordinate or y-coordinate of apre-committed position of the corresponding subpicture. Thepre-committed position may be determined among the top-left, top-right,bottom-left, and bottom-right of the subpicture. The positioninformation may be encoded by the encoding apparatus, and the decodingapparatus may determine a position of each subpicture based on theencoded position information. Here, the x-coordinate/y-coordinate may beexpressed in units such as n-sample units, CTU size, (2*CTU size),(4*CTU size), and the like. Here, n may be a natural number of 1, 2, 4,8, 16, 32, 64, 128, 256 or more. For example, in case that positioninformation is encoded using the x-coordinate and y-coordinate of thetop-left CTU of the subpicture, if the width and height are 2 and 3respectively in units of CTU (CtbSize), the position (top-left) of thesubpicture may be determined as (2*CtbSize, 3*CtbSize).

The information specifying the size of each subpicture (hereinafter,size information) may include at least one of width information andheight information of the corresponding subpicture. Here, thewidth/height information may be encoded in units such as n-sample units,CTU size, (2*CTU size), (4*CTU size), and the like. Here, n may be anatural number of 4, 8, 16, 32, 64, 128, 256 or more. For example, incase that width information is encoded in units of CTU size (CtbSize),if the width information is 6, the width of the subpicture may bedetermined as (6*CtbSize).

The above-described position information and size information may belimited to be encoded/decoded only when the number of subpicturesbelonging to a picture is two or more. That is, if the number ofsubpictures according to the number information is greater than or equalto two, the position information and the size information are signaled.Otherwise, the subpicture may be set to have the same position/size asthe picture. However, even when the number of subpictures is two ormore, position information for the first subpicture located at thetop-left of the picture may not be signaled and may be signaled fromposition information on the second subpicture. Also, at least one ofposition information or size information on the last subpicture of thepicture may not be signaled.

Referring to FIG. 3 , one subpicture may include one or more slices.That is, one subpicture may be composed of one slice or may be dividedinto a plurality of slices. The subpicture may be composed of aplurality of slices divided in the horizontal direction or may becomposed of a plurality of slices divided in the vertical direction.

Information specifying the number of slices belonging to one picture orsubpicture (hereinafter, number information) is encoded by the encodingapparatus, and the decoding apparatus may determine the number ofsubpictures in one picture or subpicture based on the encoded numberinformation. The number information may be signaled at least one levelof VPS, SPS, PPS, and PH. However, the number information may besignaled only in at least one of a case where a rectangular slice isallowed or a case where one subpicture is not composed of one slice.

Information specifying the size of each slice (hereinafter, sizeinformation) may include at least one of width information and heightinformation of the corresponding slice. Here, the width/heightinformation may be encoded in units of tiles or CTUs.

However, it may not be allowed that one slice is divided so as tooverlap a plurality of subpictures. In other words, one subpicture maybe divided to completely include one or more slices. Alternatively, aslice constituting one subpicture may be limited to be divided only ineither a horizontal direction or a vertical direction.

Referring to FIG. 3 , one subpicture or slice 310 may include one ormore tiles. That is, one slice may be composed of one tile or may becomposed of a plurality of tiles. However, the present invention is notlimited thereto, and a plurality of slices may be included in one tile.As an example, one slice may be composed of a subset of a plurality ofCTU rows belonging to one tile. In this case, information specifying thenumber of slices belonging to one tile (hereinafter, number information)is encoded by the encoding apparatus, and the decoding apparatus maydetermine the number of slices constituting one tile based on theencoded number information. Information specifying the size of eachslice (hereinafter, size information) may include at least one of widthinformation and height information of the corresponding slice. Here, thewidth/height information may be encoded in a unit of a CTU size.However, when one slice is composed of a subset of a plurality of CTUrows, only height information of the corresponding slice may besignaled, and width information may not be signaled. The number/sizeinformation may be signaled at least one level of VPS, SPS, PPS, or PH.

At least one of the above-described information on the number, position,and size is required only when the picture is divided into predeterminedfragment regions. For example, the information may be signaled only whenthe picture is divided into a plurality of slices or tiles. To this end,a separate flag indicating whether or not the current picture is dividedinto a plurality of slices or tiles may be used. The flag may besignaled at least one level of VPS, SPS, PPS, and PH.

Referring to FIG. 3 , one tile may be composed of a plurality of CTUs,and one CTU 320 (hereinafter, a first block) may be divided into aplurality of subblocks (hereinafter, a second block) by at least one ofa vertical line or a horizontal line. The number of vertical lines andhorizontal lines may be one, two, or more. Hereinafter, the first blockis not limited to the CTU, and may be a coding block (CU) divided fromthe CTU, a prediction block (PU) which is a basic unit of predictiveencoding/decoding, or a transform block (TU) which is a basic unit oftransform encoding/decoding. The first block may be a square block or anon-square block.

The division of the first block may be performed based on not only aquad tree but also a multi-tree such as a binary tree or a ternary tree.

Specifically, a quad tree division (QT) is a division type in which thefirst block is divided into four second blocks. For example, when thefirst block of 2N×2N is divided by QT, the first block may be dividedinto four second blocks having N×N size. QT may be limited to apply to asquare block only, but it is also applicable to a non-square block.

A binary tree division (BT) is a division type in which the first blockis divided into two second blocks. BT may include a horizontal binarytree (hereinafter, Horizontal BT) and a vertical binary tree(hereinafter, Vertical BT). Horizontal BT is a division type in whichthe first block is divided into two second blocks by one horizontalline. This division may be performed symmetrically or asymmetrically.For example, when the first block of 2N×2N is divided based onHorizontal BT, the first block may be divided into two second blockswith a height ratio of (a:b). Here, a and b may be the same value, and amay be larger or smaller than b. Vertical BT is a division type in whichthe first block is divided into two second blocks by one vertical line.This division may be performed symmetrically or asymmetrically. Forexample, when the first block of 2N×2N is divided based on Vertical BT,the first block may be divided into two second blocks with a width ratioof (a:b). Here, a and b may be the same value, and a may be larger orsmaller than b.

A ternary tree division (TT) is a division type in which the first blockis divided into three second blocks. Likewise, TT may include ahorizontal ternary tree (hereinafter, Horizontal TT) and a verticalternary tree (hereinafter, Vertical TT). Horizontal TT is a divisiontype in which the first block is divided into three second blocks by twohorizontal lines. For example, when the first block of 2N×2N is dividedbased on Horizontal TT, the first block may be divided into three secondblocks with a height ratio of (a:b:c). Here, a, b, and c may be the samevalue. Alternatively, a and c may be the same, and b may be greater orless than a. For example, a and c may be 2, and b may be 1. Vertical TTis a division type in which the first block is divided into three secondblocks by two vertical lines. For example, when the first block of 2N×2Nis divided based on Vertical TT, the first block may be divided intothree second blocks with a width ratio of (a:b:c). Here, a, b, and c maybe the same value or different values. Alternatively, a and c may be thesame while b may be greater or less than a. Alternatively, a and b maybe the same while c may be greater or less than a. Alternatively, b andc are the same while a may be larger or smaller than b. For example, aand c may be 2, and b may be 1.

The division described above may be performed based on the divisioninformation signaled from the encoding apparatus. The divisioninformation may include at least one of division type information,division direction information, or division ratio information.

The division type information may specify any one of the division typesthat are pre-defined in the encoding/decoding apparatus. The pre-defineddivision type may include at least one of QT, Horizontal BT, VerticalBT, Horizontal TT, Vertical TT, or non-division mode (No split).Alternatively, the division type information may mean information onwhether or not QT, BT, or TT is applied, and may be encoded in the formof a flag or an index. As an example, the division type information mayinclude at least one of a first flag indicating whether QT is applied ora second flag indicating whether BT or TT is applied. Either BT or TTmay be selectively used according to the second flag. However, the firstflag may be signaled only when the size of the first block is less thanor equal to a predetermined threshold size. The threshold size may be anatural number of 64, 128 or more. When the size of the first block isgreater than the threshold size, the first block may be forced to bedivided using only QT. In addition, the second flag may be signaled onlywhen QT is not applied according to the first flag.

In the case of BT or TT, the division direction information may indicatewhether it is divided horizontally or vertically. In the case of BT orTT, the division ratio information may indicate the ratio of the widthand/or the height of the second block.

The block 320 illustrated in FIG. 3 is assumed to be a square block(hereinafter, a first block) having a size of 8N×8N and a division depthof k. When the division information of the first block indicates QTdivision, the first block may be divided into four sub-blocks(hereinafter, a second block). The second block may have a size of 4N×4Nand may have a division depth of (k+1).

The four second blocks may be divided again based on either QT, BT, TT,or non-division mode. For example, when the division information of thesecond block indicates Horizontal BT, the second block is divided intotwo sub-blocks (hereinafter, a third block). In this case, the thirdblock may have a size of 4N×2N and may have a division depth of (k+2).

The third block may also be divided again based on either QT, BT, TT, ornon-division mode. For example, when the division information of thethird block indicates Vertical BT, the third block is divided into twosub-blocks 321 and 322. In this case, the sub-blocks 321 and 322 mayhave a size of 2N×2N and a division depth of (k+3). Alternatively, whenthe division information of the third block indicates Horizontal BT, thethird block may be divided into two sub-blocks 323 and 324. In thiscase, the sub-blocks 323 and 324 may have a size of 4N×N and a divisiondepth of (k+3).

The division may be performed independently or in parallel with theneighboring block, or may be performed sequentially according to apredetermined priority order.

The division information of the current block may be determineddepending on at least one of the division information of the upper blockof the current block or the division information of the neighboringblock. For example, when the second block is divided based on HorizontalBT and the upper third block is divided based on Vertical BT, the lowerthird block does not need to be divided based on Vertical BT. If thelower third block is divided by Vertical BT, this is the same result asthe second block is divided by QT. Therefore, encoding for the divisioninformation (particularly, the division direction information) of thelower third block may be skipped, and the decoding apparatus may be setso that the lower third block is divided in the horizontal direction.

The upper block may mean a block having a smaller division depth thanthe division depth of the current block. For example, when the divisiondepth of the current block is (k+2), the division depth of the upperblock may be (k+1). The neighboring block may be a block adjacent to thetop or left side of the current block. The neighboring block may be ablock having the same division depth as the current block.

The above-described division may be repeatedly performed up to theminimum unit of encoding/decoding. When divided into the minimum unit,the division information for the block is no longer signaled from theencoding apparatus. The information on the minimum unit may include atleast one of a size or a shape of the minimum unit. The size of theminimum unit may be expressed by the width, the height, the minimum ormaximum value of the width and height, the sum of the width and height,the number of pixels, or the division depth. The information on theminimum unit may be signaled in at least one of a video sequence, apicture, a slice, or a block unit. Alternatively, the information on theminimum unit may be a value pre-defined in the encoding/decodingapparatus. The information on the minimum unit may be signaled for eachof CU, PU, and TU. Information on one minimum unit may be applied to CU,PU, and TU equally. Blocks in the embodiments described below may beobtained through the above-described block division.

Block division according to an embodiment of the present invention maybe obtained within a supportable range, and block division settinginformation for this may be supported. For example, block divisionsetting information may include m×n size relating to the maximum codingblock (CTU), the minimum coding block, the maximum transform block, andthe minimum transform block (e.g., m and n are natural numbers such as2, 4, 8, 16, 32, 64, 128, etc.) and the maximum division depth of k foreach block (e.g., encoding/transform x Intra/Inter x QT/BT/TT, etc. k is0, 1, 2 or more). And, it may be signaled at least one level of VPS,SPS, PPS, PH, or a slice header.

In the case of some of the above-described fragment regions (subpicture,slice, tile, etc.), in order to segment/divide each fragment region (forexample, to derive position and size information of the fragmentregion), predetermined base information (for example, information on alower or base unit of a corresponding fragment region such as a CTU or atile) may be requested. In this case, the VPS-SPS-PPS may besequentially progressed, but for simultaneous encoding/decoding, it maybe necessary to provide the base information at a level that supportssegmentation/division of each fragment region.

For example, CTU information may be generated (fixedly generated) inSPS, and CTU information may be used (when divided) according to whetherto divide into subpictures (assumed to be processed in SPS).Alternatively, CTU information may be generated (when divided,additionally generated) according to whether to divide into slices ortiles (assumed to be processed in PPS), and it may be divided intoslices and tiles based on this.

In summary, base information used for segmentation/division of afragment image may be generated at one level. Alternatively, baseinformation used for segmentation/division may be generated at two ormore levels according to the type of fragment image.

Regardless of the type of the fragment image, base information (syntaxor flag) referenced to the segment of the fragment image may begenerated at one level. Alternatively, base information referenced to asegment of each fragment image may be generated at a plurality of levelsaccording to the fragment image. In this case, even if the baseinformation may occur and exist at two or more levels, the same effectas occurring and existing at one level may be maintained by setting tohave the same value or information with each other. However, in the caseof the base information, it may be a default setting to have the samevalue or information, but it is not limited thereto, and it may bepossible to change them to have different values or information.

FIG. 4 is an exemplary diagram illustrating an intra prediction modepre-defined in an image encoding/decoding apparatus as an embodiment towhich the present invention is applied.

Referring to FIG. 4 , the pre-defined intra prediction modes may bedefined as a prediction mode candidate group composed of 67 modes, andspecifically may include 65 directional modes (Nos. 2 to 66) and twonon-directional modes (DC, Planar). In this case, the directional modemay be identified based on a slope (e.g., dy/dx) or angle information(Degree). All or some of the intra prediction modes described in theabove example may be included in the prediction mode candidate group ofthe luma component or the chroma component, and other additional modesmay be included in the prediction mode candidate group.

In addition, a reconstructed block of another color space that has beenencoded/decoded using correlation between color spaces may be used forprediction of the current block, and a prediction mode supporting thismay be included. For example, in the case of a chroma component, aprediction block of the current block may be generated by using areconstructed block of a luma component corresponding to the currentblock. That is, a prediction block may be generated based on thereconstructed block, by considering correlation between color spaces.

The prediction mode candidate group may be adaptively determinedaccording to the encoding/decoding setting. The number of candidategroups may be increased for the purpose of improving the accuracy ofprediction, and the number of candidate groups may be decreased for thepurpose of reducing the amount of bits according to the prediction mode.

For example, one of candidate group A (67, 65 directional modes and 2non-directional modes), candidate group B (35, 33 directional modes and2 non-directional modes), or candidate group C (18, 17 directional modesand one non-directional mode) may be selected, and the candidate groupmay be adaptively selected or determined based on the size and shape ofthe block.

In addition, it is possible to have various configurations of theprediction mode candidate group according to the encoding/decodingsetting. For example, as shown in FIG. 4 , the prediction mode candidategroup may be configured so that a mode interval is even, or theprediction mode candidate group may be configured so that the number ofmodes between modes 18 and 34 in FIG. 4 is greater than the number ofmodes between modes 2 and 18. The opposite case may be possible. Thecandidate group may be adaptively configured according to the shape ofthe block (i.e., square, non-square with a width greater than a height,non-square with a height greater than a width, etc.).

For example, when the width of the current block is greater than theheight, all or some of the intra prediction modes belonging to modes 2to 18 may not be used, and may be replaced with all or some of the intraprediction modes belonging to modes 67 to 80. On the other hand, whenthe width of the current block is less than the height, all or some ofthe intra prediction modes belonging to modes 50 to 66 may not be used,and may be replaced with all or some of the intra prediction modesbelonging to modes −14 to −1.

In the present invention, unless otherwise specified, it is assumed thatintra prediction is performed with one preset prediction mode candidategroup (candidate group A) having an uniform mode interval, but the mainelements of the present invention may be also applied to an adaptiveintra prediction settings.

FIG. 5 illustrates a method of decoding a current block based on intraprediction as an embodiment to which the present invention is applied.

Referring to FIG. 5 , a reference region for intra prediction of acurrent block may be determined (S500).

The reference region according to the present invention may be a regionadjacent to at least one of the left, top, top-left, bottom-left, ortop-right of the current block. In addition, although not shown in FIG.5 , the reference region may further include a region adjacent to atleast one of the right, bottom-right, or bottom of the current block,and may be selectively used based on an intra prediction mode of thecurrent block, an encoding/decoding order, a scan order, etc.

The encoding/decoding apparatus may define a plurality of pixel linesavailable for intra prediction. The plurality of pixel lines may includeat least one of a first pixel line adjacent to the current block, asecond pixel line adjacent to the first pixel line, a third pixel lineadjacent to the second pixel line, or a fourth pixel line adjacent tothe third pixel line.

For example, depending on the encoding/decoding setting, the pluralityof pixel lines may include all of the first to fourth pixel lines, ormay include only the remaining pixel lines except for the third pixelline. Alternatively, the plurality of pixel lines may include only thefirst pixel line and the fourth pixel line, or may include only thefirst to third pixel lines.

The current block may select one or more of the plurality of pixel linesand use this as a reference region. In this case, the selection may beperformed based on an index (refIdx) signaled from the encodingapparatus. Alternatively, the selection may be performed based onpredetermined encoding information. Here, the encoding information mayinclude at least one of the size, shape, and division type of thecurrent block, whether the intra prediction mode is a non-directionalmode, whether the intra prediction mode is horizontal directionality, anangle of the intra prediction mode or a component type.

For example, when the intra prediction mode is a planar mode or a DCmode, only the first pixel line may be limited to be used.Alternatively, when the size of the current block is less than or equalto a predetermined threshold value, only the first pixel line may belimited to be used. Here, the size may be expressed as any one of thewidth or height of the current block (e.g., maximum value, minimumvalue, etc.), the sum of the width and height, or the number of samplesbelonging to the current block. Alternatively, when the intra predictionmode has an angle greater than a predetermined threshold angle (orsmaller than a predetermined threshold angle), only the first pixel linemay be used. The threshold angle may be an angle of an intra predictionmode corresponding to mode 2 or mode 66 in the aforementioned predictionmode candidate group.

Meanwhile, there may be a case in which at least one of the pixels ofthe reference region is not available, and in this case, the unavailablepixel may be replaced with a pre-determined default value or anavailable pixel. This will be described in detail with reference to FIG.6 .

Referring to FIG. 5 , an intra prediction mode of a current block may bederived (S510).

The current block is a concept including a luma block and a chromablock, and the intra prediction mode may be determined for each of aluma block and a chroma block. Hereinafter, it is assumed that the intraprediction mode pre-defined in the decoding apparatus is composed ofnon-directional modes (Planar mode, DC mode) and 65 directional modes.

1. In Case of Luma Block

The above-described pre-defined intra prediction modes may be dividedinto an MPM candidate group and a non-MPM candidate group. The intraprediction mode of the current block may be derived by selectively usingeither the MPM candidate group or the non-MPM candidate group. To thisend, a flag (hereinafter, a first flag) indicating whether the intraprediction mode of the current block is derived from the MPM candidategroup may be used. For example, when the first flag is a first value,the MPM candidate group may be used, and when the first flag is a secondvalue, the non-MPM candidate group may be used.

Specifically, when the first flag is the first value, the intraprediction mode of the current block may be determined based on the MPMcandidate group (candModeList) including at least one MPM candidate andan MPM index. The MPM index may be information specifying any one of MPMcandidates belonging to the MPM candidate group. The MPM index may besignaled only when a plurality of MPM candidates belong to the MPMcandidate group.

On the other hand, when the first flag is a second value (that is, whenthe same MPM candidate as the intra prediction mode of the current blockdoes not exist in the MPM candidate group), the intra prediction mode ofthe current block may be determined based on the signaled remaining modeinformation. The remaining mode information may specify any one of theremaining modes except for the MPM candidate.

Hereinafter, a method of determining the MPM candidate group will bedescribed.

(Embodiment 1) The MPM candidate group may include at least one of anintra prediction mode of a neighboring block (modeA), modeA−n, modeA+n,or a default mode. The n value may be an integer of 1, 2, 3, 4 or more.The neighboring block may mean a block adjacent to a left and/or top ofthe current block. However, the present invention is not limitedthereto, and the neighboring block may include at least one of atop-left neighboring block, a bottom-left neighboring block, or atop-right neighboring block. The default mode may be at least one of aplanar mode, a DC mode, or a predetermined directional mode. Thepredetermined directional mode may include at least one of a horizontalmode (modeV), a vertical mode (modeH), modeV−k, modeV+k, modeH−k, ormodeH+k. Here, k may be an integer of 1, 2, 3, 4, 5, or more.

The MPM index may specify the same MPM as the intra prediction mode ofthe current block among MPMs of the MPM candidate group. That is, theMPM specified by the MPM index may be set as the intra prediction modeof the current block.

(Embodiment 2) The MPM candidate group may be divided into m candidategroups. m may be an integer of 2, 3, 4 or more. Hereinafter, forconvenience of description, it is assumed that the MPM candidate groupis divided into a first candidate group and a second candidate group.

The encoding/decoding apparatus may select either the first candidategroup or the second candidate group. The selection may be performedbased on a flag (hereinafter, a second flag) that specifies whether theintra prediction mode of the current block belongs to the firstcandidate group or the second candidate group. For example, if thesecond flag is a first value, the intra prediction mode of the currentblock may be derived from the first candidate group, otherwise, theintra prediction mode of the current block may be derived from thesecond candidate group.

Specifically, when the first candidate group is used according to thesecond flag, a first MPM index specifying any one of a plurality ofdefault modes belonging to the first candidate group may be signaled.The default mode corresponding to the signaled first MPM index may beset as the intra prediction mode of the current block. On the otherhand, when the first candidate group is composed of one default mode,the first MPM index is not signaled, and the intra prediction mode ofthe current block may be set as the default mode of the first candidategroup.

When the second candidate group is used according to the second flag, asecond MPM index specifying any one of a plurality of MPM candidatesbelonging to the second candidate group may be signaled. The MPMcandidate corresponding to the signaled second MPM index may be set asan intra prediction mode of the current block. On the other hand, whenthe second candidate group is composed of one MPM candidate, the secondMPM index is not signaled, and the intra prediction mode of the currentblock may be set as the MPM candidate of the second candidate group.

Meanwhile, the second flag may be signaled only when the above-describedfirst flag is a first value (condition 1). Also, the second flag may besignaled only when the reference region of the current block isdetermined to be the first pixel line. When the current block refers tonon-adjacent pixel lines, the MPM candidates of the first candidategroup may be restricted so that they are not used. Or, conversely, whenthe intra prediction mode of the current block is derived from the firstcandidate group according to the second flag, the current block may berestricted to refer only to the first pixel line.

In addition, the second flag may be signaled only when the current blockdoes not perform intra prediction in units of subblocks (condition 2).Conversely, when the current block performs intra prediction in units ofsubblocks, the flag may not be signaled and may be set equal to thesecond value in the decoding apparatus.

When any one of the above-described conditions 1 or 2 is satisfied, thesecond flag may be signaled, or when both conditions 1 and 2 aresatisfied, the second flag may be signaled.

The first candidate group may be composed of a pre-defined default mode.The default mode may be at least one of a directional mode or anon-directional mode. For example, the directional mode may include atleast one of a vertical mode, a horizontal mode, or a diagonal mode. Thenon-directional mode may include at least one of a planar mode and a DCmode.

The first candidate group may consist of only r non-directional modes ordirectional modes. r may be an integer of 1, 2, 3, 4, 5 or more. r maybe a fixed value pre-committed to the encoding/decoding apparatus, ormay be variably determined based on a predetermined encoding parameter.

The second candidate group may include a plurality of MPM candidates.However, the second candidate group may be limited not to include thedefault mode belonging to the first candidate group. The number of MPMcandidates may be 2, 3, 4, 5, 6 or more. The number of MPM candidatesmay be a fixed value pre-committed to an encoding/decoding apparatus ormay be variably determined based on an encoding parameter. The MPMcandidate may be derived based on an intra prediction mode of aneighboring block adjacent to the current block. The neighboring blockmay be a block adjacent to at least one of the left, top, top-left,bottom-left, or top-right of the current block.

Specifically, the MPM candidate may be determined in consideration ofwhether the intra prediction mode of the left block (candIntraPredModeA)and the intra prediction mode of the top block (candIntraPredModeB) arethe same, and whether candIntraPredModeA and candIntraPredModeB arenon-directional modes.

[CASE 1] For example, when candIntraPredModeA and candIntraPredModeB arethe same, and candIntraPredModeA is not a non-directional mode, the MPMcandidate of the current block may include at least one ofcandIntraPredModeA, (candIntraPredModeA−n), (candIntraPredModeA+n), or anon-directional mode. Here, n may be an integer of 1, 2, or more. Thenon-directional mode may include at least one of a planar mode or a DCmode. As an example, the MPM candidate of the current block may bedetermined as shown in Table 1 below. The index of Table 1 specifies theposition or priority of the MPM candidate, but is not limited thereto.

TABLE 1 index MPM candidate 0 candIntraPredModeA 1 2 +((candIntraPredModeA + 61) %64) 2 2 + ((candIntraPredModeA − 1) %64) 32 + ((candIntraPredModeA + 60) %64) 4 2 + ((candIntraPredModeA %64)

[CASE 2] Or, when candIntraPredModeA and candIntraPredModeB are not thesame, and both candIntraPredModeA and candIntraPredModeB are not anon-directional mode, the MPM candidates of the current block mayinclude at least one of candIntraPredModeA, candIntraPredModeB,(maxAB−n), (maxAB+n), (minAB−n), (minAB+n), or a non-directional mode.Here, maxAB and minAB mean a maximum value and a minimum value ofcandIntraPredModeA and candIntraPredModeB, respectively, and n may be aninteger of 1, 2, or more. The non-directional mode may include at leastone of a planar mode or a DC mode. As an example, based on thedifference value D between candIntraPredModeA and candIntraPredModeB,the candidate mode of the second candidate group may be determined asshown in Table 2 below. The index of Table 2 specifies the position orpriority of the MPM candidate, but is not limited thereto.

TABLE 2 candidate mode candidate mode candidate mode candidate modeIndex (D = 1) (D = 2) (D >= 62) (Otherwise) 0 candIntraPredModeAcandIntraPredModeA candIntraPredModeA candIntraPredModeA 1candIntraPredModeB candIntraPredModeB candIntraPredModeBcandIntraPredModeB 2 2 + ((minAB + 61) %64) 2 + ((minAB − 1) %64) 2 +((minAB − 1) %64) 2 + ((minAB + 61) %64) 3 2 + ((maxAB − 1) %64) 2 +((minAB + 61) %64) 2 + ((maxAB + 61) %64) 2 + ((minAB − 1) %64) 4 2 +((minAB + 60) %64) 2 + ((maxAB − 1) %64) 2 + (minAB %64) 2 + ((maxAB +61) %64)

In Table 2 above, one of the MPM candidates is derived based on minAB,and another is derived based on maxAB. However, the present invention isnot limited thereto, and the MPM candidate may be derived based on maxABregardless of minAB, and conversely, may be derived based on minABregardless of maxAB.

[CASE 3] When candIntraPredModeA and candIntraPredModeB are not thesame, and only one of candIntraPredModeA and candIntraPredModeB is anon-directional mode, the MPM candidate of the current block may includeat least one of maxAB, (maxAB-n), (maxAB+n), or a non-directional mode.Here, maxAB denotes the maximum value of candIntraPredModeA andcandIntraPredModeB, and n may be an integer of 1, 2, or more. Thenon-directional mode may include at least one of a planar mode or a DCmode. As an example, the MPM candidate of the current block may bedetermined as shown in Table 3 below. The index of Table 3 specifies theposition or priority of the MPM candidate, but is not limited thereto.

TABLE 3 Index MPM candidate 0 maxAB 1 2 + ((maxAB + 61) %64) 2 2 +((maxAB − 1) %64) 3 2 + ((maxAB + 60) %64) 4 2 + (maxAB %64)

[CASE 4] When candIntraPredModeA and candIntraPredModeB are not thesame, and both candIntraPredModeA and candIntraPredModeB arenon-directional modes, the MPM candidates of the current block mayinclude a non-directional mode, a vertical mode, a horizontal mode,(vertical mode−m), (vertical mode+m)), (horizontal mode−m), or(horizontal mode+m). Here, m may be an integer of 1, 2, 3, 4 or more.The non-directional mode may include at least one of a planar mode or aDC mode. As an example, the MPM candidate of the current block may bedetermined as shown in Table 4 below. The index of Table 4 specifies theposition or priority of the MPM candidate, but is not limited thereto.For example, index 1 may be assigned to the horizontal mode, or thelargest index may be assigned to it. Further, the MPM candidate mayinclude at least one of a diagonal mode (e.g., mode 2, mode 34, mode66), (diagonal mode-m), or (diagonal mode+m).

TABLE 4 Index MPM candidate 0 INTRA_DC 1 Vertical mode 2 Horizontal mode3 (Vertical mode − 4) 4 (Vertical mode + 4)

The intra prediction mode (IntraPredMode) decoded through theabove-described process may be changed/corrected based on apredetermined offset, which will be described in detail with referenceto FIG. 7 .

2. In the Case of Chroma Blocks

A pre-defined intra prediction modes for a chroma block may be dividedinto a first group and a second group. Here, the first group may beconfigured with inter-components reference-based prediction modes, andthe second group may be configured with all or some of theabove-described pre-defined intra prediction modes.

The intra prediction mode of the chroma block may be derived byselectively using either the first group or the second group. Theselection may be performed based on a predetermined third flag. Thethird flag may indicate whether the intra prediction mode of the chromablock is derived based on the first group or the second group.

For example, when the third flag is a first value, the intra predictionmode of the chroma block may be determined as one of one or moreinter-components reference-based prediction modes belonging to the firstgroup. This will be described in detail in FIG. 8 .

On the other hand, when the third flag is a second value, the intraprediction mode of the chroma block may be determined as one of aplurality of intra prediction modes belonging to the second group. As anexample, the second group may be defined as shown in Table 5, and theintra prediction mode of the chroma block may be derived based oninformation (intra_chroma_pred_mode) signaled by the encoding apparatusand the intra prediction mode (IntraPredModeY) of the luma block.

TABLE 5 IntraPredModeY[ xCb + cbWidth/2 ][ yCb + cbHeight / 2 ]intra_chroma_pred_mode[ xCb ][ yCb ] 0 50 18 1 X (0 <= X <= 66) 0 66 0 00 0 1 50 66 50 50 50 2 18 18 66 18 18 3 1 1 1 66 1 4 0 50 18 1 X

According to Table 5, the intra prediction mode of the chroma block maybe determined based on the signaled information and the intra predictionmode of the luma block. The mode numbers listed in Table 5 correspond tothe mode numbers in FIG. 4 . For example, when a value of the signaledinformation intra_chroma_pred_mode is 0, the intra prediction mode ofthe chroma block may be determined as the diagonal mode 66 or the planarmode (0) according to the intra prediction mode of the luma block.Alternatively, when the value of the signaled informationintra_chroma_pred_mode is 4, the intra prediction mode of the chromablock may be set to be the same as the intra prediction mode of the lumablock. Meanwhile, the intra prediction mode (IntraPredModeY) of the lumablock may be an intra prediction mode of a subblock including a specificposition in the luma block. Here, the specific position in the lumablock may correspond to a center position in the chroma block.

However, there may be a case where a subblock in the luma blockcorresponding to the center position in the chroma block is notavailable. Here, “not available” may be a case in which thecorresponding subblock is not encoded in an intra mode. For example,when a subblock does not have an intra prediction mode, such as when acorresponding subblock is encoded in an inter mode or a current picturereference mode, it may be determined that the corresponding subblock isnot available. In this case, the intra prediction mode (IntraPredModeY)of the luma block may be set equal to a mode pre-committed to theencoding/decoding apparatus. Here, the pre-committed mode may be any oneof a planar mode, a DC mode, a vertical mode, or a horizontal mode.

Referring to FIG. 5 , the current block may be decoded based on thereference region for intra prediction and the intra prediction mode(S520).

The decoding of the current block may be performed in units of subblocksof the current block. To this end, the current block may be divided intoa plurality of subblocks. Here, the current block may correspond to aleaf node. The leaf node may mean a coding block that is no longerdivided into smaller coding blocks. That is, the leaf node may mean ablock that is no longer divided through the tree-based block divisiondescribed above.

The division may be performed based on the size of the current block(Embodiment 1).

For example, when the size of the current block is less than apredetermined threshold size, the current block may be divided into twovertically or horizontally. Conversely, when the size of the currentblock is greater than or equal to the threshold size, the current blockmay be divided into four vertically or horizontally. The threshold sizemay be signaled by the encoding apparatus or may be a fixed valuepre-defined in the decoding apparatus. For example, the threshold sizeis expressed as N×M, and N and M may be 4, 8, 16 or more. The N and Mmay be the same or may be set differently from each other.

Alternatively, if the size of the current block is less than thepredetermined threshold size, the current block is not divided(non-split). Otherwise, the current block may be divided into two orfour.

The division may be performed based on the shape of the current block(Embodiment 2).

For example, if the shape of the current block is a square, the currentblock is divided into four, and otherwise, the current block may bedivided into two. Conversely, if the shape of the current block is asquare, the current block is divided into two, and otherwise, thecurrent block may be divided into four.

Alternatively, if the shape of the current block is a square, thecurrent block is divided into two or four, and otherwise, the currentblock may not be divided. Conversely, when the shape of the currentblock is a square, the current block is not divided, and otherwise, thecurrent block may be divided into two or four.

The division may be performed by selectively applying any one of theabove-described embodiment 1 or 2, or the division may be performedbased on a combination of the embodiments 1 and 2.

The two-division means dividing into two in either vertical orhorizontal direction, and the four-division may include dividing intofour in either vertical or horizontal direction or dividing into four invertical and horizontal directions.

In the above embodiment, two- or four-division is described, but thepresent invention is not limited thereto, and the current block may bedivided into three in a vertical or horizontal direction. In this case,the ratio of the width or height may be (1:1:2), (1:2:1), or (2:1:1).

Information on whether to divide into subblock units, whether to divideinto four, a division direction, and a division number may be signaledfrom the encoding apparatus or variably determined by the decodingapparatus based on a predetermined encoding parameter. Here, theencoding parameter may mean a block size/shape, a division type(for-division, two-division, three-division), an intra prediction mode,a range/position of a neighboring pixel for intra prediction, acomponent type (e.g., luma and chroma), a maximum/minimum size of atransform block, a transform type (e.g., transform skip, DCT2, DST7,DCT8), and the like.

Subblocks of the current block may be sequentiallypredicted/reconstructed according to a predetermined priority. In thiscase, a first subblock of the current block may bepredicted/reconstructed, and a second subblock may bepredicted/reconstructed with reference to the pre-decoded firstsubblock. Regarding the priority, it is predicted/reconstructed in theorder of top->bottom, but each subblock at the top and bottom may bepredicted/reconstructed in the order of left->right. Alternatively, itis predicted/reconstructed in the order of top->bottom, but eachsub-block at the top and bottom may be predicted/reconstructed in theorder of right->left. Alternatively, it is predicted/reconstructed inthe order of bottom->top, but each subblock at the bottom and top may bepredicted/reconstructed in the order of left->right. Alternatively, itis predicted/reconstructed in the order of bottom->top, but eachsubblock at the bottom and top may be predicted/restored in the order ofright->top. Alternatively, it is predicted/reconstructed in the order ofleft->right, but each subblock at the left and right may bepredicted/reconstructed in the order of top->bottom. Alternatively, itis predicted/reconstructed in the order of left->right, but eachsubblock at the left and right may be predicted/reconstructed in theorder of bottom->top. Alternatively, it is predicted/reconstructed inthe order of right->left, but each sub-block at the right and left maybe predicted/reconstructed in the order of top->bottom. Alternatively,it is predicted/reconstructed in the order of right->left, but eachsub-block at the right and left may be predicted/reconstructed in theorder of bottom->top.

The encoding/decoding apparatus may define any one of theabove-described orders and use the same. Alternatively, theencoding/decoding apparatus may define at least two or more of theabove-described orders and selectively use any one of them. To this end,an index or flag specifying any one of a pre-defined orders may beencoded and signaled.

FIG. 6 illustrates a method of replacing an unavailable pixel in areference region as an embodiment to which the present invention isapplied.

As described above, the reference region may be determined as one of thefirst to fourth pixel lines. However, in the present embodiment, forconvenience of description, it is assumed that the reference region isthe first pixel line. The present embodiment may be applied in the samemanner or similarly to the second to fourth pixel lines.

When all the pixels in the reference region are not available, thecorresponding pixel may be replaced with one of a range of pixel valuesexpressed by a bit depth or a range of actual pixel values of an image.For example, the maximum value, minimum value, median value, averagevalue, etc. of a range of the pixel values may correspond to a value tobe replaced. When the bit depth is 8, all pixels of the reference regionmay be filled with 128 when replacing with the median value of the bitdepth.

However, if not, that is, not all pixels of the reference region are notavailable, but at least one of the pixels of the reference region is notavailable, the replacement process may be performed for at least one ofthe top reference region, the left reference region, the right referenceregion, or bottom reference region of the current block. For theconvenience of explanation, the description will focus on the left, top,and right reference regions of the current block.

(STEP1) It is determined whether the top-left pixel TL adjacent to thecurrent block (prediction block) is not available. If the top-left pixelTL is not available, the pixel may be replaced with a median value ofthe bit depth.

(STEP2) It is possible to sequentially search whether an unavailablepixel exists in the top reference region. Here, the top reference regionmay include a pixel line adjacent to at least one of the top or thetop-right of the current block. The length of the top reference regionmay be equal to the width of the current block (nW), (2*nW), or the sumof the width and the height (nW+nH).

Here, the search direction may be performed from left to right. In thiscase, when it is determined that the pixel p[x][−1] is not available,the pixel p[x][−1] may be replaced with the neighboring pixelp[x−1][−1]. Alternatively, the search direction may be performed fromright to left. In this case, when it is determined that the pixelp[x1][−1] is not available, the pixel p[x][−1] may be replaced with theneighboring pixel p[x+1][−1].

(STEP3) It is possible to sequentially search whether an unavailablepixel exists in the left reference region. Here, the left referenceregion may include a pixel line adjacent to at least one of the left orthe bottom-left of the current block. The length of the left referenceregion may be equal to the height of the current block (nH), (2*nH) orthe sum of the width and the height (nW+nH).

Here, the search direction may be performed from top to bottom. In thiscase, when it is determined that the pixel p[−1][y] is not available,the pixel p[−1][y] may be replaced with the neighboring pixelp[−1][y−1]. Alternatively, the search direction may be performed frombottom to top. In this case, when it is determined that the pixelp[−1][y] is not available, the pixel p[−1][y] may be replaced with theneighboring pixel p[−1][y+1].

(STEP4) It is possible to sequentially search whether an unavailablepixel exists in the right reference region. Here, the right referenceregion may include a pixel line adjacent to the right of the currentblock. The length of the right reference region may be the same as theheight of the current block (nH).

Here, the search direction may be performed from top to bottom. In thiscase, when it is determined that the pixel p[nW][y] is not available,the pixel p[nW][y] may be replaced with the neighboring pixelp[nW][y−1]. Alternatively, the search direction may be performed frombottom to top. In this case, when it is determined that the pixelp[nW][y] is not available, the pixel p[nW][y] may be replaced with theneighboring pixel p[nW][y+1].

Alternatively, a separate search process may be omitted for the rightreference region. Instead, an unavailable pixel in the right referenceregion may be filled with the median value of the bit depth.Alternatively, an unavailable pixel in the right reference region may bereplaced with one of the top-right pixel TR or the bottom-right pixel BRadjacent to the current block, or may be replaced with a representativevalue thereof. Here, the representative value may be expressed as anaverage value, a maximum value, a minimum value, a mode value, a medianvalue, and the like. Alternatively, the unavailable pixel in the rightreference region may be derived by applying a predetermined weight toeach of the top-right pixel TR and the bottom-right pixel BR. In thiscase, the weight may be determined in consideration of a first distancebetween an unavailable pixel in the right reference region and atop-right pixel TR and a second distance between an unavailable pixel inthe right reference region and a bottom-right pixel BR. The bottom-rightpixel BR may be filled with one of a top-left pixel TL, a top-rightpixel TR, or a bottom-left pixel BL adjacent to the current block, ormay be replaced with a representative value of at least two of atop-left pixel TL, a top-right pixel TR, or a bottom-left pixel BL.Here, the representative value is as described above. Alternatively, thebottom-right pixel BR may be derived by applying a predetermined weightto at least two of the top-left pixel TL, the top-right pixel TR, or thebottom-left pixel BL, respectively. Here, the weight may be determinedin consideration of a distance from the bottom-right pixel BR.

Meanwhile, the above-described replacement process is not limited tobeing performed in the priority of top->left->right. For example, thereplacement process may be performed in the priority ofleft->top->right. Alternatively, the replacement process may beperformed in parallel for the top and left reference regions, and thenmay be performed for the right reference region. In addition, the STEP1process may be omitted when the replacement process is performed in thepriority of left->top->right.

FIG. 7 illustrates a method of changing/correcting an intra predictionmode as an embodiment to which the present invention is applied.

The decoded intra prediction mode (IntraPredMode) may be changed basedon a predetermined offset. The application of the offset may beselectively performed based on at least one of a block property, thatis, a size, a shape, division information, a division depth, a value ofan intra prediction mode, or a component type. Here, the block may meanthe current block and/or a neighboring block of the current block.

The division information may include at least one of first informationindicating whether the current block is divided into a plurality ofsubblocks, second information indicating a division direction (e.g.,horizontal or vertical), or third information on the number of dividedsubblocks. The division information may be encoded and signaled by anencoding apparatus. Alternatively, some of the division information maybe variably determined in the decoding apparatus based on theabove-described block property, or may be set to a fixed valuepre-defined in the encoding/decoding apparatus.

For example, if the first information is a first value, the currentblock is divided into a plurality of subblocks, otherwise, the currentblock may not be divided into a plurality of subblocks (NO_SPLIT). Whenthe current block is divided into a plurality of subblocks, the currentblock may be horizontally divided (HOR_SPLIT) or vertically divided(VER_SPLIT) based on the second information. In this case, the currentblock may be divided into k subblocks. Here, k may be an integer of 2,3, 4 or more. Alternatively, k may be limited to a power of 2, such as1, 2, 4, etc. Alternatively, in the case of a block in which at leastone of a width or a height of the current block is 4 (for example, 4×8,8×4), k is set to 2, otherwise, k is set to 4, 8, or 16. When thecurrent block is non-divided (NO_SPLIT), k may be set to 1.

The current block may be divided into subblocks having the same widthand height, or may be divided into subblocks having different widths andheights. The current block may be divided into N×M block units (e.g.,2×2, 2×4, 4×4, 8×4, 8×8, etc.) pre-committed to the encoding/decodingapparatus, regardless of the property of the above-described block.

The offset may be applied only when the size of the current block isless than or equal to a predetermined threshold value T1. Here, thethreshold value T1 may mean a maximum block size to which an offset isapplied. Alternatively, it may be applied only when the size of thecurrent block is greater than or equal to a predetermined thresholdvalue T2. In this case, the threshold value T2 may mean the minimumblock size to which the offset is applied. The threshold value may besignaled through a bitstream. Alternatively, it may be variablydetermined by the decoding apparatus based on at least one of theabove-described block properties or may be a fixed value pre-committedto the encoding/decoding apparatus.

Alternatively, the offset may be applied only when the shape of thecurrent block is non-square. For example, when the following conditionsare satisfied, a predetermined offset (e.g., 65) may be added to theIntraPredMode of the current block.

-   -   nW is greater than nH    -   IntraPredMode is greater than or equal to 2    -   IntraPredMode is less than (whRatio>1)?(8+2*whRatio): 8

Here, nW and nH denote the width and height of the current block,respectively, and whRatio may be set to Abs(Log 2(nW/nH)).

Alternatively, when the following conditions are satisfied, apredetermined offset (e.g., 67) may be subtracted from the IntraPredModeof the current block.

-   -   nH is greater than nW    -   IntraPredMode is less than or equal to 66    -   IntraPredMode is greater than (whRatio>1)?(60−2*whRatio): 60

As described above, the final intra prediction mode may be determined byadding/subtracting the offset to the intra prediction mode(IntraPredMode) of the current block in consideration of the property ofthe current block. However, the present invention is not limitedthereto, and the application of the offset may be performed in thesame/similar manner in consideration of the properties (e.g., size,shape) of the subblock instead of the current block.

FIG. 8 illustrates an inter-components reference-based prediction methodin an embodiment to which the present disclosure is applied.

The current block may be divided into a luma block and a chroma blockaccording to a component type. The chroma block may be predicted usingthe pixel of the reconstructed luma block. This is referred to as aninter-components reference. In this embodiment, it is assumed that thechroma block has a size of (nTbW×nTbH), and the luma block correspondingto the chroma block has a size of (2*nTbW×2*nTbH).

Referring to FIG. 8 , an intra prediction mode of a chroma block may bedetermined (S800).

As described in FIG. 5 , the intra prediction mode of the chroma blockmay be determined as one of one or more inter-components reference-basedprediction modes belonging to the first group according to the thirdflag. The first group may be composed of only inter-componentsreference-based prediction modes. The encoding/decoding apparatus maydefine at least one of INTRA_LT_CCLM, INTRA_L_CCLM, or INTRA_T_CCLM asan inter-components reference-based prediction mode. INTRA_LT_CCLM is amode that refers to both the left and top regions adjacent to theluma/chroma blocks, INTRA_L_CCLM is a mode that refers to the leftregion adjacent to the luma/chroma blocks, and INTRA_T_CCLM is a modethat refers to the top region adjacent to the luma/chroma blocks.

A predetermined index may be used to select any one of theinter-components reference-based prediction modes. The index may beinformation specifying any one of INTRA_LT_CCLM, INTRA_L_CCLM, orINTRA_T_CCLM. The index may be signaled only when the third flag is afirst value. The inter-components reference-based prediction modesbelonging to the first group and the indexes assigned to each predictionmode are shown in Table 6 below.

TABLE 6 Idx inter-components reference-based prediction mode 0INTRA_LT_CCLM 1 INTRA_L_CCLM 2 INTRA_T_CCLM

Table 6 is only an example of an index assigned to each prediction mode,but is not limited thereto. That is, as shown in Table 6, indexes may beassigned in the priority order of INTRA_LT_CCLM, INTRA_L_CCLM,INTRA_T_CCLM, or indexes may be assigned in the priority order ofINTRA_LT_CCLM, INTRA_T_CCLM, INTRA_L_CCLM. Alternatively, INTRA_LT_CCLMmay have a lower priority order than INTRA_T_CCLM or INTRA_L_CCLM. Thethird flag may be selectively signaled based on information indicatingwhether the inter-components reference is allowed. For example, if avalue of the information is 1, the third flag may be signaled,otherwise, the third flag may not be signaled. Here, the information maybe determined as 0 or 1 based on a predetermined condition describedlater.

(Condition 1) When a fourth flag indicating whether inter-componentsreference-based prediction is allowed is 0, the information may be setto 0. The fourth flag may be signaled in at least one of VPS, SPS, PPS,PH, and slice header.

(Condition 2) When at least one of the following sub-conditions issatisfied, the information may be set to 1.

-   -   qtbtt_dual_tree_intra_flag is equal to 0    -   a slice type is not I-slice    -   a size of a coding tree block is less than 64×64

In condition 2, qtbtt_dual_tree_intra_flag may indicate whether a codingtree block is implicitly divided into a 64×64 coding block and a 64×64coding block is divided based on a dual tree. The dual tree may refer toa method in which a luma component and a chroma component are dividedwith an independent division structure. The size of the coding treeblock (CtbLog2Size) may be a size (e.g., 64×64, 128×128, 256×256)pre-defined in an encoding/decoding apparatus, or may be encoded andsignaled by an encoding apparatus.

(Condition 3) When at least one of the following sub-conditions issatisfied, the information may be set to 1.

-   -   a width and a height of a first upper block are 64    -   a depth of a first upper block is the same as (CtbLog2Size-6),        the first upper block is divided based on Horizontal BT, and a        second upper block is 64×32    -   a depth of the first upper block is greater than (CtbLog2Size-6)    -   a depth of the first upper block is the same as (CtbLog2Size-6),        the first upper block is divided based on Horizontal BT, and a        second upper block is divided based on Vertical BT

In condition 3, the first upper block may be a block including thecurrent chroma block as a lower block. For example, when the depth ofthe current chroma block is k, the depth of the first upper block is(k-n), and n may be 1, 2, 3, 4 or more. The depth of the first upperblock may mean only a depth according to division based on a quad tree,or may mean a depth according to division of at least one of a quadtree, a binary tree, or a ternary tree. The second upper block is alower block belonging to the first upper block, and may have a depthless than a current chroma block and a depth greater than the firstupper block. For example, when the depth of the current chroma block isk, the depth of the second upper block is (k-m), and m may be a naturalnumber less than n.

When neither of the above-described conditions 1 to 3 is satisfied, theinformation may be set to 0.

However, even when at least one of conditions 1 to 3 is satisfied, whenat least one of the following sub-conditions is satisfied, theinformation may be reset to 0.

-   -   the first upper block is 64×64 and the above-described        subblock-based prediction is performed    -   at least one of the width or height of the first upper block is        less than 64 and the depth of the first upper block is equal to        (CtbLog2Size-6)

Referring to FIG. 8 , a luma region for inter-components reference ofthe chroma block may be specified (S810).

The luma region may include at least one of a luma block or aneighboring region adjacent to the luma block. Here, the luma block maybe defined as a region including pixels pY[x][y](x=0 . . . nTbW*2−1, y=0. . . nTbH*2−1). The pixels may mean reconstructed values before thein-loop filter is applied.

The neighboring region may include at least one of a left neighboringregion, a top neighboring region, or a top-left neighboring region. Theleft neighboring region may be set as a region including pixelspY[x][y](x=−1 . . . −3, y=0 . . . 2*numSampL−1). The setting may beperformed only when the value of numSampL is greater than 0. The topneighboring region may be set as a region including pixels pY[x][y] (x=0. . . 2*numSampT−1, y=−1 . . . -3). The setting may be performed onlywhen the value of numSampT is greater than 0. The top-left neighboringregion may be set as a region including pixels pY[x][y] (x=−1, y=−1,−2).The setting may be performed only when the top-left region of the lumablock is available.

The above-described numSampL and numSampT may be determined based on theintra prediction mode of the current block. Herein, the current blockmay denote the chroma block.

For example, when the intra prediction mode of the current block isINTRA_LT_CCLM, it may be derived based on Equation 9. Here,INTRA_LT_CCLM may mean a mode in which inter-components reference isperformed based on left and top neighboring regions to the currentblock.numSampT=availT?nTbW:0numSampL=availL?nTbH:0  [Equation 1]

According to Equation 1, numSampT is derived as nTbW when the topneighboring region to the current block is available. Otherwise,numSampT may be derived as 0. Similarly, numSampL is derived as nTbHwhen the left neighboring region to the current block is available.Otherwise, numSampL may be derived as 0.

To the contrary, when the intra prediction mode of the current block isnot INTRA_LT_CCLM, it may be derived based on Equation 2 below.numSampT=(availT && predModeIntra==INTRA_T_CCLM)?(nTbW+numTopRight):0numSampL=(availL &&predModeIntra==INTRA_L_CCLM)?(nTbH+numLeftBelow):0  [Equation 2]

In Equation 2, INTRA_T_CCLM may refer to a mode in whichinter-components reference is performed based on a top neighboringregion to the current block. INTRA_L_CCLM may mean a mode in whichinter-components reference is performed based on a left neighboringregion to the current block. numTopRight may mean the number of all orsome pixels belonging to a top-right neighboring region to the chromablock. Some pixels may refer to available pixels among pixels belongingto the lowest pixel row of the corresponding region. In an availabilitydetermination, whether the pixels are available may determinedsequentially in a left to a right direction. This process may beperformed until an unavailable pixel is found numLeftBelow may mean thenumber of all or some pixels belonging to a bottom-left neighboringregion to the chroma block. Some pixels may refer to available pixelsamong pixels belonging to the rightmost pixel line (column) of thecorresponding region. In the availability determination, whether pixelsare available may be determined sequentially in a top to a bottomdirection. This process may be performed until an unavailable pixel isfound.

Referring to FIG. 8 , down-sampling may be performed on the luma regionspecified in S810 (S820).

The down-sampling may include at least one of 1. Down-sampling of theluma block, 2. Down-sampling of the left neighboring region to the lumablock, or 3. Down-sampling of the top neighboring region to the lumablock. This will be described in detail below.

1. Down-Sampling of Luma Block

(Embodiment 1)

The pixel pDsY[x][y] (x=0 . . . nTbW−1, y=0 . . . nTbH−1) of thedown-sampled luma block may be derived based on a corresponding pixelpY[2*x][2*y] of the luma block and the neighboring pixel. Theneighboring pixel may mean at least one of a left neighboring pixel, aright neighboring pixel, a top neighboring pixel, or a bottomneighboring pixel to the corresponding pixel. For example, the pixelpDsY[x][y] may be derived based on Equation 3 below.pDsY[x][y]=(pY[2*x][2*y−1]+pY[2*x−1][2*y]+4*pY[2*x][2*y]+pY[2*x+1][2*y]+pY[2*x][2*y+1]+4)>>3  [Equation3]

However, there may be a case where the left/top neighboring region tothe current block are not available. When the left neighboring region tothe current block is not available, the pixel pDsY[0][y] (y=1 . . .nTbH−1) of the down-sampled luma block may be derived based on thecorresponding pixel pY[0] [2*y] of the luma block and the neighboringpixel of the corresponding pixel. The neighboring pixel may mean atleast one of the top neighboring pixel or the bottom neighboring pixelto the corresponding pixel. For example, pixel pDsY[0][y] (y=1 . . .nTbH−1) may be derived based on Equation 4 below.pDsY[0][y]=(pY[0][2*y−1]+2*pY[0][2*y]+pY[0][2*y+1]+2)>>2  [Equation 4]

When the top neighboring region to the current block is not available,the pixel pDsY[x][0] (x=1 . . . nTbW−1) of the down-sampled luma blockmay be derived based on the corresponding pixel pY[2*x] [0] of the lumablock and the neighboring pixel of the corresponding pixel. Theneighboring pixel may mean at least one of the left neighboring pixel orthe right neighboring pixel to the corresponding pixel. For example, thepixel pDsY[x] [0] (x=1 . . . nTbW−1) may be derived based on Equation 5below.pDsY[x][0]=(pY[2*x−1][0]+2*pY[2*x][0]+pY[2*x+1][0]+2)>>2  [Equation 5]

The pixel pDsY[0] [0] of the down-sampled luma block may be derivedbased on the corresponding pixel pY[0][0] of the luma block and/or aneighboring pixel of the corresponding pixel. The position of theneighboring pixel may vary depending on whether left/top neighboringregions to the current block are available.

For example, when the left neighboring region is available but the topneighboring region is not available, pDsY[0][0] may be derived based onEquation 6 below.pDsY[0][0]=(pY[−1][0]+2*pY[0][0]+pY[1][0]+2)>>2  [Equation 6]

To the contrary, when the left neighboring region is not available, butthe top neighboring region is available, pDsY[0][0] may be derived basedon Equation 7 below.pDsY[0][0]=(pY[0][−1]+2*pY[0][0]+pY[0][1]+2)>>2  [Equation 7]

In another example, when both the left and top neighboring regions arenot available, pDsY[0][0] may be set as the corresponding pixel pY[0][0]of the luma block.

(Embodiment 2)

The pixel pDsY[x][y] (x=0 . . . nTbW−1, y=0 . . . nTbH−1) of thedown-sampled luma block may be derived based on the corresponding pixelpY[2*x][2*y] of the luma block and the neighboring pixel of thecorresponding pixel. The neighboring pixel may mean at least one of abottom neighboring pixel, a left neighboring pixel, a right neighboringpixel, a bottom-left neighboring pixel, or a bottom-right neighboringpixel to the corresponding pixel. For example, the pixel pDsY[x][y] maybe derived based on Equation 8 below.pDsY[x][y]=(pY[2*x−1][2*y]+pY[2*x-1][2*y+1]+2*pY[2*x][2*y]+2*pY[2*x][2*y+1]+pY[2*x+1][2*y]+pY[2*x+1][2*y+1]+4)>>3  [Equation8]

However, when the left neighboring region to the current block is notavailable, the pixel pDsY[0][y] (y=0 . . . nTbH−1) of the down-sampledluma block may be derived based on the corresponding pixel pY[0][2*y] ofthe luma block and a bottom neighboring pixel thereto. For example, thepixel pDsY[0][y] (y=0 . . . nTbH−1) may be derived based on Equation 9below.pDsY[0][y]=(pY[0][2*y]+pY[0][2*y+1]+1)>>1  [Equation 9]

Down-sampling of the luma block may be performed based on one ofEmbodiments 1 and 2 as described above. Here, one of Embodiments 1 and 2may be selected based on a pre-determined flag. The flag may indicatewhether the down-sampled luma pixel has the same position as that of theoriginal luma pixel. For example, when the flag is a first value, thedown-sampled luma pixel has the same position as that of the originalluma pixel. To the contrary, when the flag is a second value, thedown-sampled luma pixel has the same position as that of the originalluma pixel in the horizontal direction, but has a position shifted byhalf pel in the vertical direction.

2. Down-Sampling of Left Neighboring Region to Luma Block

(Embodiment 1)

The pixel pLeftDsY[y] (y=0 . . . numSampL−1) of the down-sampled leftneighboring region may be derived based on the corresponding pixelpY[−2][2*y] of the left neighboring region and a neighboring pixel ofthe corresponding pixel. The neighboring pixel may mean at least one ofa left neighboring pixel, a right neighboring pixel, a top neighboringpixel, or a bottom neighboring pixel to the corresponding pixel. Forexample, the pixel pLeftDsY[y] may be derived based on Equation 10below.pLeftDsY[y]=(pY[−2][2*y−1]+pY[−3][2*y]+4*pY[−2][2*y]+pY[−1][2*y]+pY[−2][2*y+1]+4)>>3  [Equation10]

However, when the top-left neighboring region to the current block isnot available, the pixel pLeftDsY[0] of the down-sampled leftneighboring region may be derived based on the corresponding pixelpY[−2][0] of the left neighboring region and a neighboring pixel of thecorresponding pixel. The neighboring pixel may mean at least one of theleft neighboring pixel or a right neighboring pixel to the correspondingpixel. For example, the pixel pLeftDsY[0] may be derived based onEquation 11 below.pLeftDsY[0]=(pY[−3][0]+2*pY[−2][0]+pY[−1][0]+2)>>2  [Equation 11]

(Embodiment 2)

The pixel pLeftDsY[y] (y=0 . . . numSampL−1) of the down-sampled leftneighboring region may be derived based on the corresponding pixelpY[−2] [2*y] of the left neighboring region and a neighboring pixelaround the corresponding pixel. The neighboring pixel may mean at leastone of a bottom neighboring pixel, a left neighboring pixel, a rightneighboring pixel, a bottom-left neighboring pixel, or a bottom-rightneighboring pixel to the corresponding pixel. For example, the pixelpLeftDsY[y] may be derived based on following Equation 12.pLeftDsY[y]=(pY[−1][2*y]+pY[−1][2*y+1]+2*pY[−2][2*y]+2*pY[−2][2*y+1]+pY[−3][2*y]+pY[−3][2*y+1]+4)>>3  [Equation12]

Similarly, down-sampling of the left neighboring region may be performedbased on one of Embodiments 1 and 2 as described above. Here, one ofEmbodiments 1 and 2 may be selected based on a pre-determined flag. Theflag indicates whether the down-sampled luma pixel has the same positionas that of the original luma pixel. This is the same as described above.

Down-sampling of the left neighboring region may be performed only whenthe numSampL value is greater than 0. When the numSampL value is greaterthan 0, it may mean that the left neighboring region to the currentblock is available, and the intra prediction mode of the current blockis INTRA_LT_CCLM or INTRA_L_CCLM.

3. Down-Sampling of Top Neighboring Region to Luma Block

(Embodiment 1)

The pixel pTopDsY[x] (x=0 . . . numSampT−1) of the down-sampled topneighboring region may be derived in consideration of whether the topneighboring region belongs to a CTU different from a CTU to which theluma block belongs.

When the top neighboring region belongs to the same CTU as the lumablock, the pixel pTopDsY[x] of the down-sampled top neighboring regionmay be derived based on the corresponding pixel pY[2*x][−2] of the topneighboring region and a neighboring pixel of the corresponding pixel.The neighboring pixel may mean at least one of a left neighboring pixel,a right neighboring pixel, a top neighboring pixel, or a bottomneighboring pixel to the corresponding pixel. For example, the pixelpTopDsY[x] may be derived based on Equation 13 below.pTopDsY[x]=(pY[2*x][−3]+pY[2*x−1][−2]+4*pY[2*x][−2]+pY[2*x+1][−2]+pY[2*x][−1]+4)>>3  [Equation13]

To the contrary, when the top neighboring region belongs to a CTUdifferent from the luma block, the pixel pTopDsY[x] of the down-sampledtop neighboring region may be derived based on the corresponding pixelpY[2*x][4] of the top neighboring region and a neighboring pixel of thecorresponding pixel. The neighboring pixel may mean at least one of theleft neighboring pixel or the right neighboring pixel to thecorresponding pixel. For example, the pixel pTopDsY[x] may be derivedbased on Equation 14 below.pTopDsY[x]=(pY[2*x−1][−1]+2*pY[2*x][−1]+pY[2*x+1][−1]+2)>>2  [Equation14]

Alternatively, when the top-left neighboring region to the current blockis not available, the neighboring pixel may mean at least one of the topneighboring pixel or the bottom neighboring pixel to the correspondingpixel. For example, the pixel pTopDsY[0] may be derived based onEquation 15 below.pTopDsY[0]=(pY[0][−3]+2*pY[0][−2]+pY[0][−1]+2)>>2  [Equation 15]

Alternatively, when the top-left neighboring region to the current blockis unavailable and the top neighboring region belongs to a CTU differentfrom the luma block, the pixel pTopDsY[0] may be set as the pixelpY[0][−1] of the top neighboring region.

(Embodiment 2)

The pixel pTopDsY[x] (x=0 . . . numSampT−1) of the down-sampled topneighboring region may be derived in consideration of whether the topneighboring region belongs to a CTU different from the luma block.

When the top neighboring region belongs to the same CTU as the lumablock, the pixel pTopDsY[x] of the down-sampled top neighboring regionmay be derived based on the corresponding pixel pY[2*x][−2] of the topneighboring region and a neighboring pixel of the corresponding pixel.The neighboring pixel may mean at least one of a bottom neighboringpixel, a left neighboring pixel, a right neighboring pixel, abottom-left neighboring pixel, or a bottom-right neighboring pixel tothe corresponding pixel. For example, the pixel pTopDsY[x] may bederived based on Equation 16 below.pTopDsY[x]=(pY[2*x−1][−2]+pY[2*x−1][−1]+2*pY[2*x][−2]+2*pY[2*x][−1]+pY[2*x+1][−2]+pY[2*x+1][−1]+4)>>3  [Equation16]

To the contrary, when the top neighboring region belongs to a CTUdifferent from the luma block, the pixel pTopDsY[x] of the down-sampledtop neighboring region may be derived based on the corresponding pixelpY[2*x][4] of the top neighboring region and a neighboring pixel of thecorresponding pixel. The neighboring pixel may mean at least one of theleft neighboring pixel or the right neighboring pixel to thecorresponding pixel. For example, the pixel pTopDsY[x] may be derivedbased on Equation 17 below.pTopDsY[x]=(pY[2*x−1][−1]+2*pY[2*x][−1]+pY[2*x+1][−1]+2)>>2  [Equation17]

Alternatively, when the top-left neighboring region to the current blockis not available, the neighboring pixel may mean at least one of the topneighboring pixel or the bottom neighboring pixel to the correspondingpixel. For example, the pixel pTopDsY[0] may be derived based onEquation 18 below.pTopDsY[0]=(pY[0][−2]+pY[0][−1]+1)>>1  [Equation 18]

Alternatively, when the top-left neighboring region to the current blockis unavailable and the top neighboring region belongs to a CTU differentfrom the luma block, the pixel pTopDsY[0] may be set as pixel pY[0][−1]of the top neighboring region.

In the similar manner, down-sampling of the top neighboring region maybe performed based on one of Embodiments 1 and 2 as described above.Here, one of Embodiments 1 and 2 may be selected based on apre-determined flag. The flag indicates whether the down-sampled lumapixel has the same position as that of the original luma pixel. This isthe same as described above.

Meanwhile, down-sampling of the top neighboring region may be performedonly when the numSampT value is greater than 0. When the numSampT valueis greater than 0, it may mean that the top neighboring region to thecurrent block is available, and the intra prediction mode of the currentblock is INTRA_LT_CCLM or INTRA_T_CCLM.

Down-sampling for at least one of the left or top neighboring regions ofthe luma block (hereinafter, luma reference region) may be performedusing only the corresponding pixel pY[−2][2*y] at a specific positionand the surrounding pixels. Here, the specific position may bedetermined based on a position of a selected pixel among a plurality ofpixels belonging to at least one of the left or top neighboring regionsof the chroma block (hereinafter, referred to as chroma referenceregion).

The selected pixel may be an odd-numbered pixel or an even-numberedpixel in the chroma reference region. Alternatively, the selected pixelmay be a start pixel and one or more pixels positioned at predeterminedintervals from the start pixel. Here, the start pixel may be a pixelpositioned at the first, second, or third position in the chromareference region. The interval may be 1, 2, 3, 4 or more sampleintervals. For example, when the interval is one sample interval, theselected pixel may include an n^(th) pixel, an (n+2)^(th) pixel, and thelike. The number of selected pixels may be 2, 4, 6, 8 or more.

The number of selected pixels, the starting pixel, and the interval maybe variably determined based on at least one of a length of a chromareference region (i.e., numSampL and/or numSampT) or an intra predictionmode of a chroma block. Alternatively, the number of selected pixels maybe a fixed number (e.g., 4) pre-committed to the encoding/decodingapparatus regardless of the length of the chroma reference region andthe intra prediction mode of the chroma block.

Referring to FIG. 8 , a parameter for inter-components reference of thechroma block may be derived (S830).

The parameter may include at least one of a weight or an offset. Theparameter may be determined in consideration of the intra predictionmode of the current block. The parameter may be derived using a selectedpixel of the chroma reference region and a pixel obtained throughdown-sampling of the luma reference region.

Specifically, n pixels may be classified into two groups by performingsize comparison between n pixels obtained through down-sampling of theluma reference region. For example, a first group may be a group ofpixels having a relatively large value among n pixels, and a secondgroup may be a group of pixels other than the pixels of the first groupamong n samples. That is, the second group may be a group of pixelshaving a relatively small value. Here, n may be 4, 8, 16 or more. Anaverage value of pixels belonging to the first group may be set as amaximum value MaxL, and an average value of pixels belonging to thesecond group may be set as a minimum value MinL.

According to grouping of n pixels obtained through down-sampling of theluma reference region, selected pixels of the chroma reference regionmay be grouped. A first group for the chroma reference region isconfigured by using pixels of the chroma reference region correspondingto the pixels of the first group of the luma reference region. A secondgroup for the chroma reference region may be configured by using pixelsof the chroma reference region corresponding to the pixels of the secondgroup of the luma reference region. Similarly, the average value of thepixels in the first group may be set as the maximum value MaxC, and theaverage value of the pixels in the second group may be set as theminimum value MinC.

Based on the calculated maximum values (MaxL, MaxC) and minimum values(MinL, MaxC), the weight and/or offset of the parameter may be derived.

The chroma block may be predicted based on the down-sampled luma blockand the parameter (S840).

The chroma block may be predicted by applying at least one of apre-derived weight or offset to a pixel of the down-sampled luma block.

FIG. 9 illustrates a method of configuring a reference region as anembodiment to which the present invention is applied.

The reference region according to the present invention may be a regionadjacent to the current block. Next, a method of configuring eachreference region as available pixels by classifying the reference regionaccording to categories will be described. For the convenience ofexplanation, the description will focus on the left, top, rightreference regions of the current block. Descriptions not mentioned inthe embodiments to be described later may be referenced or derivedthrough the embodiment described with reference to FIG. 6 .

Referring to FIG. 9 , pixels in the reference region may be classifiedinto a predetermined category (SA00).

The reference region may be identified/classified into k categories, andk may be an integer of 1, 2, 3 or more. Alternatively, k may be limitedto an integer of 2 or less. The reference region may be classified asone of predetermined categories based on an image type (I/P/B), acomponent type (Y/Cb/Cr, etc.), block property (size, shape, divisioninformation, division depth, etc.), and a position of the referencepixel. Here, the block may mean a current block and/or a neighboringblock of the current block.

For example, it may be classified into a predetermined categoryaccording to the size of the block. In case of the size of the block, asupport range may be determined by a threshold size. Each threshold sizemay be expressed as W, H, W×H, and W*H based on width (W) and height(H). W and H may be natural numbers such as 4, 8, 16, 32, etc. Two ormore threshold sizes are supported and may be used to set a supportrange such as a minimum value and a maximum value that a block may have.

Alternatively, it may be classified into a predetermined categoryaccording to the position of the reference pixel. In this case, theposition of the reference pixel may be defined in units of pixels, ormay be defined as a direction of a block to which the reference pixelbelongs (left, right, top, bottom, top-left, top-right, bottom-left,bottom-right).

Referring to FIG. 6 , it may be defined as whether it is included amongthe positions of the top-left pixel TL, the top-right pixel TR, thebottom-left pixel BL, and the bottom-right pixel BR. Also, it may bedefined as whether it is included among the pixel positions of TL0, TL1,TR0, TR1, BL0, BL1, BR0, BR1 located based on the current blocks width(2*nW), height (2*nH) or the sum of width and height (nW+nH). Inaddition, referring to FIG. 12 , it may be defined as whether it isincluded among the pixel positions of T0, T3, B0, B3, L0, L3, R0, andR3, which are pixels located at both ends of a top, bottom, left, andright blocks. Alternatively, it may be defined as whether it is includedamong pixels (T1, L2, B2, R1, etc.) located at the middle of each block.

A reference region (reference pixel) may be classified into eachcategory based on the various encoding elements.

Referring to FIG. 9 , an unavailable pixel belonging to the referenceregion may be searched (SA10).

It is possible to sequentially search whether there are the unavailablepixel in the reference region. Referring to FIG. 6 , the start positionof the search may be determined among TL, TR, BL, and BR, but is notlimited thereto. In this case, when the search is performedsequentially, the number of the start position of the search may be setto one, but for the case of parallel processing, it may be set to two ormore.

The search region of the unavailable pixel may be determined based onthe start position of the search. If one search position is designated(assuming TL), the top reference region or the left reference region maybe searched before the right reference region, but this may not be thecase in encoding setting (parallel processing).

Here, the search direction may be determined to be one of clockwise orcounterclockwise. In this case, one of the clockwise or counterclockwisemay be selected for the entire reference region. Alternatively, it maybe adaptively selected according to the position of the referenceregion. That is, one search direction of the clockwise orcounterclockwise may be supported for each of top/bottom/left/rightreference regions. Here, it should be understood that the position ofthe reference region is not limited only to the width (nW) and height(nH) of the current block (i.e., including reference region included in2*nW, 2*nH, nW+nH, etc.).

Here, in the case of a clockwise direction, it may mean a bottom to topdirection in a left reference region, a left to right direction in a topreference region, a top to bottom direction in a right reference region,and a right to left direction in a bottom reference region.Counterclockwise may be derived from the opposite of the clockwise.

For example, when the search is started from the top-left pixel TLadjacent to the current block, the top reference region and the rightreference region may be searched in a clockwise direction (left->right,top->bottom). In addition, the left reference region and the bottomreference region may be searched in a counterclockwise direction(top->bottom, left->right). However, the above description is only apartial example, and examples of various modifications may be possible.

Referring to FIG. 9 , it may be replaced with an available pixel byusing a method set for each category (SA20).

An unavailable pixel may be replaced with a predetermined default value(e.g., a median value of a pixel value range). Alternatively, it may bereplaced based on a predetermined available pixel, and an unavailablepixel may be replaced with a value obtained through copying, linearextrapolation, interpolation, or the like of one or more adjacentavailable pixels. First, a process of classifying a category based on aposition of each pixel precedes. The following is an example of how eachmethod is applied according to a plurality of categories, and theunavailable pixel is referred to as a target pixel.

As an example <1>, when an available pixel exists in the referenceregion, the target pixel may be replaced by using a pixel value obtainedbased on the available pixel, and when no available pixel exists in thereference region, it may be replaced with a default value.

As an example <2>, when an available pixel exists before the targetpixel and at the start position of the search, the target pixel may bereplaced by using a pixel value obtained based on the available pixel,and when no available pixel exists before the target pixel, it may bereplaced with a default value.

As an example <3>, the target pixel may be replaced with a defaultvalue.

In the case of <1>, a method of replacing with an available pixelaccording to whether or not an available pixel exists in the referenceregion is described. In the case of <2>, a method of replacing with anavailable pixel according to whether or not an available pixel existduring the previous search process is described. In the case of <3>, amethod of replacing with one fixed available pixel is described.

If one category is supported, one method of <1> to <3> may be used. Ifmore than one category are supported, one reference pixel belonging toany one category may select and use one of <1> to <3>, and a referencepixel belonging to another category may select and use one of <1> to<3>.

Referring to FIG. 9 , the reference region may be configured as anavailable pixel (SA30). In addition, intra prediction may be performed(SA40).

A method of replacing with an available pixel according to categories byclassifying the unavailable pixels in the reference region intocategories has been described through the above-described embodiments.In addition, not only the unavailable pixel but also the available pixelmay be replaced with a default value, another available pixel, or avalue obtained based on other available pixel.

FIG. 10 is an exemplary diagram for configuring an intra prediction modeset step by step as an embodiment to which the present invention isapplied.

Referring to (Step 1) of FIG. 10 , configuration of various predictionmode candidate groups may be supported, and one of them may beimplicitly or explicitly selected. The prediction mode candidate groupmay be identified by the number of modes, slope information (dy/dx) ofthe directional mode, a support range of the directional mode, and thelike. In this case, even if the number of modes is k (a directional, bnon-directional), there may be prediction mode candidates with differenta or b.

The prediction mode candidate group selection information may beexplicitly generated, and may be signaled at least one level among VPS,SPS, PPS, PH, and slice header. Alternatively, a prediction modecandidate group may be implicitly selected according to the encodingsetting. In this case, the encoding setting may be defined based on animage type (UP/B), a component type, and a block property (size, shape,division information, division depth, etc.). Here, the block may mean acurrent block and/or a neighboring block of the current block, and inthe present embodiment, the same description may be applied.

When one prediction mode candidate group is selected through (Step 1) (Bis selected in this example), intra prediction or prediction modeencoding may be performed based on this. Alternatively, a process forefficient candidate group configuration may be performed, and this willbe described through (Step 2).

Referring to (Step 2) of FIG. 10 , the configuration of some predictionmodes may be variously configured, and one of them may be implicitly orexplicitly selected. (B0) to (B2) may be candidate configurationsassuming that prediction modes (dotted lines in the drawing) in somedirections are not well used.

Prediction mode candidate group selection information may be explicitlygenerated and may be signaled in a CTU, a coding block, a predictionblock, a transform block, and the like. Alternatively, a prediction modecandidate group may be implicitly selected according to the encodingsetting, and the encoding setting may be defined as previous variousencoding elements.

Here, the shape of the block may be subdivided according to thewidth/height ratio (W:H) of the block, and the prediction mode candidategroup may be configured differently according to all possible ratios ofW:H, or according to only a certain ratio of W:H.

When one prediction mode candidate group is selected through (Step 2)(B1 is selected in this example), intra prediction or prediction modeencoding may be performed based on this. Alternatively, a process forefficient candidate group configuration may be performed, and this willbe described through (Step 3).

Referring to (Step 3) of FIG. 10 , it may be candidate configurationsassuming that some prediction modes (dotted lines in the drawing) arenot well used because the number of prediction mode candidate groups aremany.

The prediction mode candidate group selection information may beexplicitly generated, and may be signaled in a CTU, a coding block, aprediction block, a transform block, and the like. Alternatively, aprediction mode candidate group may be implicitly selected according tothe encoding setting, and the encoding setting may be defined asprevious various encoding elements. In addition, a prediction mode, aposition, etc. of a block may be elements additionally considered indefining the encoding setting.

In this case, the prediction mode and the position of the block may meaninformation on a neighboring block adjacent to the current block. Thatis, based on property information of the current block and theneighboring block, a prediction mode that is estimated to be not wellused may be derived, and the corresponding mode may be excluded from theprediction mode candidate group.

For example, when a neighboring block includes positions TL, T0, TR0,L0, and BL0 of FIG. 12 , it is assumed that the prediction mode of thecorresponding block has some directionality (from top-left tobottom-right). In this case, the prediction mode of the current blockmay be expected to have some directionality with a high probability, andthe following processing possibility may exist.

For example, intra prediction may be performed on all modes within theprediction mode candidate group. In addition, prediction mode encodingmay be performed based on the prediction mode candidate group.

Alternatively, intra prediction may be performed on a mode within aprediction mode candidate group from which some modes have been removed.In addition, prediction mode encoding may be performed based on theprediction mode candidate group from which some modes have been removed.

Comparing the above examples, it may be distinguished whether aprediction mode that is thought to have a low probability of occurrenceis included in the actual prediction and encoding process (which may beincluded as a non-MPM, etc.) or is removed.

In the case of (B21) in which the prediction mode having a differentdirectionality from the prediction mode of the neighboring block may bepartially removed, it may be an example in which some sparsely arrangedmodes are removed for the case where the corresponding directional modeactually occurs.

FIGS. 11A-11D illustrates a method of classifying intra prediction modesinto a plurality of candidate groups as an embodiment to which thepresent invention is applied.

A case of classifying into one or more candidate groups for decoding ofthe intra prediction mode will be described below, and it may be thesame as or similar to the aforementioned MPM candidate group and non-MPMcandidate group. Therefore, parts not mentioned in the presentembodiment may be derived identically or similarly through the previousembodiment. In the case of the present embodiment, a method of expandingthe number of candidate groups and configuring the candidate group willbe described later.

The intra prediction mode of the current block may be derived byselectively using any one of a plurality of candidate groups. For thispurpose, a selection flag may be used as many as (the number ofcandidate groups−1) or less.

For example, when the prediction mode is classified into three candidategroups (A, B, C), a flag (first flag) indicating whether the intraprediction mode of the current block is derived from the candidate groupA may be used.

In this case, when the first flag is a first value, the candidate groupA is used, and when the first flag is a second value, a flag (secondflag) indicating whether the intra prediction mode of the current blockis derived from the candidate group B may be used.

In this case, when the second flag is a first value, the candidate groupB is used, and when the second flag is a second value, the candidategroup C may be used. In the above example, three candidate groups aresupported, and for this, a first flag and a second flag, that is, atotal of two selection flags may be used.

When one of the candidate groups is selected, the intra prediction modeof the current block may be determined based on the candidate group anda candidate group index. The candidate group index may be informationspecifying any one of candidates belonging to the candidate group. Thecandidate group index may be signaled only when a plurality ofcandidates belong to the candidate group.

The configuration of the selection flag when three candidate groups aresupported has been described through the above example. As in the aboveconfiguration, flags indicating whether the prediction mode of thecurrent block is derived from a candidate group having a high prioritymay be sequentially supported (e.g., in the order of a first flag->asecond flag). That is, when a predetermined candidate group selectionflag is generated and a corresponding candidate group is not selected,the selection flag of candidate group having the next priority may begenerated.

Alternatively, it may be a configuration having a different meaning fromthe selection flag (EE). For example, a flag (first flag) indicatingwhether the intra prediction mode of the current block is derived fromthe candidate groups A or B may be used.

In this case, when the first flag is a first value, the candidate groupC is used, and when the first flag is a second value, a flag (secondflag) indicating whether the intra prediction mode of the current blockis derived from the candidate group A may be used.

In this case, when the second flag is a first value, the candidate groupA may be used, and when the second flag is a second value, the candidategroup B may be used.

Each of candidate groups A, B, and C may have m, n, and p candidates,and m may be an integer of 1, 2, 3, 4, 5, 6 or more. n may be an integerof 1, 2, 3, 4, 5, 6 or more. Alternatively, n may be an integer between10 and 40. p may be (the total number of prediction modes-m-n). Here, mmay be less than or equal to n, and n may be less than or equal to p.

As another example, when the prediction mode is classified into fourcandidate groups (A, B, C, D), flags indicating whether the intraprediction mode of the current block is derived from the candidategroups A, B, C (first flag, second flag, third flag) may be used.

In this case, the second flag may be generated when the first flag isthe second value, and the third flag may be generated when the secondflag is the second value. That is, when the first flag is the firstvalue, the candidate group A may be used, and when the second flag isthe first value, the candidate group B may be used. In addition, whenthe third flag is the first value, the candidate group C may be used,and when the third flag is the second value, the candidate group D maybe used. In this example, the opposite configuration is also possible asin some examples (EE) of the configuration of three candidate groups.

Alternatively, the second flag may be generated when the first flag isthe first value, and the third flag may be generated when the first flagis the second value. When the second flag is the first value, thecandidate group A may be used, and when the second flag is the secondvalue, the candidate group B may be used. When the third flag is thefirst value, the candidate group C may be used, and when the secondvalue is the second value, the candidate group D may be used.

Each of candidate groups A, B, C, and D may have m, n, p, and qcandidates, and m may be an integer of 1, 2, 3, 4, 5, 6 or more. n maybe an integer of 1, 2, 3, 4, 5, 6 or more. Alternatively, n may be aninteger between 8 and 24. p may be an integer such as 6, 7, 8, 9, 10,11, 12, and the like. Alternatively, p may be an integer between 10 and32. q may be (the total number of prediction modes-m-n-p). Here, m maybe less than or equal to n, n may be less than or equal to p, and p maybe less than or equal to q.

Next, when multiple candidate groups are supported, a method ofconfiguring each candidate group will be described. The reason forsupporting a plurality of candidate groups is for the purpose ofefficient intra prediction mode decoding. That is, a prediction modethat is expected to be the same as the intra prediction mode of thecurrent block is configured as a candidate group with a high priority,and the prediction mode that is not expected to be the same as the intraprediction mode of the current block is configured as a candidate groupwith a low priority.

For example, in FIGS. 11 -A11D, when category 2(a), category 3 (b andc), and category 4 (d) are the candidate groups with the lowestpriority, respectively, the candidate groups may be configured using aprediction mode that is not included in any of the candidates with theprevious priority. In this embodiment, since the candidate group iscomposed of the remaining prediction modes that are not included in thepreceding candidate group, it is assumed that it is the candidate groupirrelevant to the priority between the prediction modes configuring eachcandidate group to be described later (i.e., the remaining predictionmodes that are not included in the previous candidate group withoutconsidering the priority). And, it is assumed that the priority(priority) between candidate groups is in ascending order (category1->category 2->category 3->category 4) as shown in FIG. 11D, and thepriority in the examples described later is a term used in listing modesto configure each candidate group.

Like the aforementioned MPM candidate group, a candidate group may beconfigured with a prediction mode of a neighboring block, a defaultmode, a predetermined directional mode, or the like. For the purpose ofassigning a less amount of bits to the prediction mode with the highestprobability of occurrence, a candidate group may be configured bydetermining a predetermined priority for configuring a candidate group.

Referring to FIG. 11A, a priority for a first candidate group(Category 1) may be supported. When the first candidate group isconfigured based on the number of the first candidate group according tothe priority, the remaining prediction modes (b, j, etc.) may beconfigured as a second candidate group (Category 2).

Referring to FIG. 11B, common priority for the first candidate group andthe second candidate group may be supported. According to the priority,the first candidate group is configured based on the number of the firstcandidate group. The second candidate group is configured based on thenumber of the second candidate group according to the priority (after c)after the prediction mode (e) finally included in the first candidategroup. In addition, the remaining prediction modes (b, j, etc.) may beconfigured as a third candidate group (Category 3).

Referring to FIG. 11C, individual priorities (first priority, secondpriority) for the first candidate group and the second candidate groupmay be supported. The first candidate group is configured based on thenumber of the first candidate group according to a first priority. Then,the second candidate group is configured based on the number of thesecond candidate group according to a second priority. In addition, theremaining prediction modes (b, w, x, etc.) may be configured as thethird candidate group.

Here, the second priority may be set based on a prediction mode of theneighboring block <1>, a default mode <2>, a predetermined directionalmode <3>, and the like, like the existing priority (first priority).However, the priority may be set based on an importance different fromthe first priority (e.g., if the first priority is configured in theorder of 1-2-3, the second priority is configured in the order of 3-2-1,etc.). In addition, the second priority may be variably configuredaccording to the mode included in the previous candidate group, and maybe affected by the mode of the neighboring block of the current block.The second priority may be configured differently from the firstpriority, but it may be understood that the configuration of the secondpriority may be partially affected by the configuration of the firstcandidate group. In this paragraph, it should be understood that thefirst priority (previous ranking), the first candidate group (previouscandidate group), and the second priority (current ranking) and thesecond candidate group (current candidate group) are not described in afixed ranking such as a number.

Referring to FIG. 11D, a common priority (first priority) for the firstcandidate group and the second candidate group may be supported, andindividual priority (second priority) for the third candidate group maybe supported. The first candidate group is configured based on thenumber of the first candidate group according to the first priority. Thesecond candidate group is configured based on the number of the secondcandidate group according to the priority (after e) after the predictionmode (d) finally included in the first candidate group. Then, accordingto the second priority, the third candidate group is configured based onthe number of the third candidate group. In addition, the remainingprediction modes (u, f, etc.) may be configured as the fourth candidategroup.

According to an embodiment of the present invention, in case of theintra prediction mode of the current block, the prediction modes may beconfigured with one or more candidate groups, and a prediction modedecoding may be performed based on this. In this case, one or morepriorities used for configuring the candidate group may be supported.The priority may be used in the process of configuring one or morecandidate groups.

In the above example, when two or more priorities are supported, apriority (second priority) separate from the priority (first priority)used in the preceding candidate group (first candidate group) is usedfor another candidate group (the second candidate group). This maycorrespond to the case where all candidates in one candidate group areconfigured according to one priority.

In addition, the first priority used for the first candidate group maybe used to configure some candidates of the second candidate group. Thatis, some candidates (cand_A) of the second candidate group may bedetermined based on the first priority (starting from a mode notincluded in the first candidate group), and some candidates (orremaining candidates. cand_B) of the second candidate group may bedetermined based on the second priority. In this case, cand_A may be aninteger of 0, 1, 2, 3, 4, 5 or more. That is, when configuring the firstcandidate group, a prediction mode that is not included in the firstcandidate group may be included in the second candidate group.

For example, three candidate groups are supported, and the firstcandidate group consists of two candidates, and the first priority maybe determined among a prediction mode of an adjacent block (e.g., left,top), a predetermined directional mode (e.g., Ver, Hor, etc.), apredetermined non-directional mode (e.g., DC, Planar, etc.) (e.g.,Pmode_L-Pmode_U-DC-Planar-Ver-Hor, etc.). The candidate group isconfigured based on the number of the first candidate group according tothe first priority (e.g., Pmode_L, Pmode_U).

In this case, the second candidate group is configured with 6candidates, and the second priority may be determined among adirectional mode having a predetermined interval (1, 2, 3, 4 or moreinteger) from the prediction mode of the adjacent block and adirectional mode having a predetermined slope (dy/dx. 1:1, 1:2, 2:1,4:1, 1:4, etc.) (e.g., Diagonal down left-Diagonal down right-Diagonalup right-<Pmode_L+2>, <Pmode_U+2>, etc.).

The second candidate group may be configured based on the number of thesecond candidate group according to a second priority. Alternatively,two candidates of the second candidate group may be configured (DC,Planar) based on a first priority, and the remaining four candidates maybe configured (DDL, DDR, DUR) based on a second priority.

For convenience of explanation, the same terms as the previousdescription are used, such as the first candidate group, the secondcandidate group, and the first priority, but it should be noted that thepriority between the candidate groups among the plurality of candidategroups is not fixed to the first and second.

In summary, when it is classified into a plurality of candidate groupsfor prediction mode decoding and one or more priorities are supported, apredetermined candidate group may be configured based on one or morepriorities.

FIG. 12 is an exemplary diagram illustrating a current block and a pixeladjacent thereto as an embodiment to which the present invention isapplied.

Referring to FIG. 12 , pixels (a to p) belonging to a current block andpixels adjacent thereto are shown. In detail, it represents pixels(Ref_T, Ref_L, Ref_TL, Ref_TR, and Ref_BL) that are adjacent to thecurrent block and referenceable, and pixels (B0 to B3, R0 to R3, BR)that are adjacent to the current block, but are not referenceable. Thisis a diagram assuming that some coding order, scan order, etc. are fixed(the left, top, top-left, top-right, and bottom-left blocks of thecurrent block may be referred to), and it is possible to change into adifferent configuration according to the change of the encoding setting.

FIG. 13 illustrates a method of performing intra prediction step by stepas an embodiment to which the present invention is applied.

The current block may perform intra prediction using pixels located inthe left, right, top, and bottom directions. In this case, as shown inFIG. 12 , not only pixels that can be referenced but also pixels thatcannot be referenced may exist. Encoding efficiency may be improved byestimating pixel values not only for referenceable pixels but also fornon-referenceable pixels and using them.

Referring to FIG. 13 , an arbitrary pixel value may be obtained (SB00).

Here, the arbitrary pixel may be a pixel that cannot be referencedaround the current block or a pixel inside the current block. Anarbitrary pixel position will be described with reference to thefollowing drawing.

FIG. 14 is an exemplary diagram for an arbitrary pixel for intraprediction as an embodiment to which the present invention is applied.

Referring to FIG. 14 , not only a pixel (c) located outside the currentblock and cannot be referenced, but also a pixel (a, b) located insidethe current block may be the arbitrary pixel. The following assumes thatthe size of the current block is Width×Height and a top-left coordinateis (0, 0).

In FIG. 14 , a and b may be located in (0, 0) to (Width-1, Height-1).

For example, it may be located on the boundary line (left, right, top,bottom) of the current block. For example, it may be located in theright column of the current block, (Width-1, 0) to (Width-1, Height-1)or the bottom row of the current block, (0, Height-1) to (Width-1,Height-1).

For example, it may be located in odd or even column and row of thecurrent block. For example, it may be located in an even row of thecurrent block or it may be located in an odd column of the currentblock. Alternatively, it may be located in an even row and an odd columnof the current block, or may be located in an odd row and an odd columnof the current block. Here, in addition to the odd or even number, itmay be located in a column or row corresponding to a multiple of k or anexponent (2k), and k may be an integer of 1, 2, 3, 4, 5 or more.

In FIG. 14 , c may be located outside the referenceable pixel and thecurrent block.

As an example, it may be located on the boundary line of the currentblock (in this example, right, bottom). For example, it may be locatedon the right boundary of the current block, (Width, 0) to (Width,Height), or the bottom boundary of the current block, (0, Height) to(Width, Height).

For example, it may be located in odd or even column and row of thecurrent block. For example, it may be located in an even row beyond theright boundary of the current block, or it may be located in an oddcolumn beyond the bottom boundary of the current block. Here, inaddition to the odd or even number, it may be located in a column or rowcorresponding to a multiple of k or an exponent (2k), and k may be aninteger of 1, 2, 3, 4, 5 or more.

The number of arbitrary pixels used/referenced for intra prediction ofthe current block may be m, and m may be 1, 2, 3, 4 or more.Alternatively, the number of arbitrary pixels may be set based on thesize (width or height) of the current block. For example, the number ofarbitrary pixels used for intra prediction may be Width/w_factor,Height/h_factor, or (Width*Height)/wh_factor. Here, w_factor andh_factor may be pre-determined values used as division values based onthe width and height of each block, and may be integers such as 1, 2, 4,and 8. Here, wh_factor may be a pre-determined value used as a divisionvalue based on the size of the block, and may be an integer such as 2,4, 8, 16, and the like.

Also, the number of arbitrary pixels may be determined based on all orsome of encoding elements such as an image type, a component type, ablock property, and an intra prediction mode.

An arbitrary pixel obtained through the above process may be obtainedfrom a region which can refer to a corresponding pixel value. Forexample, a pixel value may be obtained based on a referenceable pixellocated in a horizontal or vertical direction of an arbitrary pixel.

In this case, a pixel value of an arbitrary pixel may be obtained as avalue obtained through copy or weight average using one or more pixels(k. k is an integer of 1, 2, 3, 4, 5, 6, etc.) located in (<1>horizontal direction/<2> vertical direction). In the (<1> horizontaldirection/<2> vertical direction), a referenceable pixel having the sameor similar (<1>y component/<2>x component) among the coordinates of anarbitrary pixel may be used/referenced to obtain a pixel value. However,in a broad sense, a referenceable pixel located in the (<1>leftdirection/<2>top direction) of the current block may be used to obtain apixel value of an arbitrary pixel.

A pixel value may be obtained based on either the horizontal directionor the vertical direction, or may be obtained based on both directions.In this case, a pixel value acquisition setting may be determined basedon various encoding elements (described in the above example, such as animage type and a block property).

For example, when the current block has a rectangular shape having awidth greater than a height, a pixel value of an arbitrary pixel may beobtained based on a referenceable pixel located in the verticaldirection. Alternatively, when primary pixel values are obtained basedon each of referenceable pixels located in the vertical direction andthe horizontal direction, a secondary pixel value (i.e., a pixel valueof an arbitrary pixel) may be obtained by applying further a weight tothe primary pixel value obtained in the vertical direction rather thanthe primary pixel value obtained in the horizontal direction.

Alternatively, when the current block has a rectangular shape having aheight greater than a width, a pixel value of an arbitrary pixel may beobtained based on a referenceable pixel located in the horizontaldirection. Alternatively, when primary pixel values are obtained basedon each of referenceable pixels located in the vertical direction andthe horizontal direction, a secondary pixel value (i.e., a pixel valueof an arbitrary pixel) may be obtained by applying further a weight tothe primary pixel value obtained in the horizontal direction rather thanthe primary pixel value obtained in the vertical direction. Of course,it is not limited to the above example, and the opposite configurationmay also be possible.

In addition, a predetermined candidate list may be configured and apixel value of an arbitrary pixel may be obtained by selecting at leastone of them. It may be signaled in one of units such as a CTU, a codingblock, a prediction block, and a transform block. In this case, thecandidate list may be configured with a pre-determined value or may beconfigured based on the above-described referenceable pixel adjacent tocurrent block. In this case, the number of candidate lists may be aninteger of 2, 3, 4, 5 or more. Alternatively, it may be an integerbetween 10 and 20, an integer between 20 and 40, or an integer between10 and 40.

Here, in the candidate list, a pixel value may be configured as acandidate, or an equation for inducing the pixel value, a feature value,and the like may be configured as a candidate. In the latter case,various pixel values may be derived in an arbitrary pixel unit based onan equation for obtaining a position (x- or y-coordinate) of anarbitrary pixel and a pixel value or the feature value.

As described above, one or more arbitrary pixels may be obtained, andintra prediction may be performed based on them. In the following, forconvenience of explanation, it is assumed that the number of arbitrarypixels is 1. However, it is clear that the example described later maybe extended to the same or similar case even when two or more arbitrarypixels are obtained.

Referring to FIG. 13 , it may be divided into a plurality of sub-regionsbased on an arbitrary pixel (SB10).

Here, the sub-regions may be partitioned based on a horizontal orvertical line including the arbitrary pixel, and the number ofsub-regions may be an integer of 2, 3, 4 or more. The configuration ofthe sub-region will be described with reference to the followingdrawing.

FIG. 15 is an exemplary diagram of dividing into a plurality ofsub-regions based on an arbitrary pixel as an embodiment to which thepresent invention is applied.

Referring to FIG. 15 , a predetermined sub-region (b, c), which is avertical or horizontal line of an arbitrary pixel d, may be obtained,and a predetermined sub-region (a) may be obtained based on vertical andhorizontal lines.

In this case, a sub-region (b) may be obtained between an arbitrarypixel and a pixel T that can be referenced in a vertical direction, anda sub-region (c) may be obtained between an arbitrary pixel and a pixelL that can be referenced in a horizontal direction. In this case, thesub-regions b and c may not always occur fixedly, and only one of thetwo may occur according to an arbitrary pixel-related setting of thecurrent block (e.g., b or c is also an arbitrary pixel, etc.). If onlyone of the sub-regions b and c occurs, the sub-region a may not beoccurred.

As shown in FIG. 15 , T or L may refer to a referenceable pixel adjacentto the current block. Alternatively, T or L may refer to any pixel (e,f) different from d located in the vertical or horizontal direction ofthe arbitrary pixel (d). This means that any pixel d may also be a T orL of any other pixel.

As in the above example, the size of the sub-region may be determinedbased on the number and arrangement of arbitrary pixels in the currentblock.

For example, when two or more arbitrary pixels exist and are located atintervals of one slot, each of the sub-regions a, b, and c may have asize of 1×1. Alternatively, when one arbitrary pixel exists and islocated at c of FIG. 14 , sub-regions a, b, and c may have a size of(Width×Height), (1×Height), and (Width×1), respectively.

Referring to FIG. 13 , intra prediction may be performed according to apredetermined order (SB20).

Here, according to a position of an arbitrary pixel, some sub-regionsmay be used as a prediction value for intra prediction or may be used asa temporary reference value for intra prediction.

For example, when an arbitrary pixel (or sub-region d) is located at cof FIG. 14 , sub-regions b and c are located outside the current block,and only sub-region a may be a target of intra prediction.Alternatively, when an arbitrary pixel is located above c of FIG. 14 ,the sub-region b is located outside the current block, and thesub-regions a and c may be targets of intra prediction. Alternatively,when an arbitrary pixel is located on the left side of c of FIG. 14 ,the sub-region c is located outside the current block, and thesub-regions a and b may be targets of intra prediction. Alternatively,when an arbitrary pixel is located inside the current block, sub-regionsa, b, and c may be targets of intra prediction.

As in the above example, according to the position of an arbitrarypixel, it may be the target of intra prediction or may be used as atemporary reference value.

The following description assumes a case in which an arbitrary pixel islocated inside the current block, but even if a change to the positionoccurs, the following example may be applied and understood in the sameor similar manner.

Since a position and a pixel value of the arbitrary pixel are obtainedthrough the previous steps, each sub-region acquisition process may beperformed according to a predetermined priority among the sub-regions a,b, and c. For example, a pixel value of each sub-region may be obtainedin the order of b->c or c->b, and a pixel value of sub-region a may beobtained.

In the case of the sub-region b, a pixel value may be obtained based onan arbitrary pixel d or T. In the case of the sub-region c, a pixelvalue may be obtained based on an arbitrary pixel d or L.

Although not shown in the drawing, assume that the top-left pixel is TL(i.e., the intersection of the horizontal line of T and the verticalline of L). When TL and T are located on the top of the current block, apixel between TL and T may be referred to. Also, when TL and L arelocated on the left side of the current block, a pixel between TL and Lmay be referred to. It is because the referenceable pixel belongs to ablock adjacent to the current block.

On the other hand, when at least one TL or T is located inside thecurrent block, a pixel between TL and T may be referred to. In addition,when at least one of TL or L is located inside the current block, apixel between TL and L may be referred to. It is because thereferenceable pixel may be a sub-region obtained based on anotherarbitrary pixel.

Therefore, in the case of the sub-region a, a pixel value may beobtained based on the sub-regions b and c, the referenceable regionbetween TL and T, and the referenceable region between TL and L. Ofcourse, TL, T, L, and d may be used to obtain pixel values of thesub-region a. Here, it means that any pixel may be also referred.

Through the above process, intra prediction of the current block may beperformed based on the arbitrary pixel.

Performing intra prediction based on the arbitrary pixel may beconfigured as one of the intra prediction modes or may be included as areplacement for an existing mode.

Alternatively, it may be classified as one candidate of predictionmethods and selection information for this may be generated. Forexample, it may be considered as an additional prediction method to amethod of performing intra prediction based on a directional mode or anon-directional mode. The selection information may be signaled in aCTU, a coding block, a prediction block, a transform block, or the like.

The following will be described on the assumption that the arbitrarypixel position is c of FIG. 14 . However, the present invention is notlimited thereto, and the contents described below may be applied in thesame or similar manner even when arranged in different positions. Thefollowing will be described with reference to FIG. 12 .

Although the current block and the right and bottom blocks of thecurrent block have not been encoded, they may be estimated based on dataof a referenceable region.

For example, data may be copied or derived from Ref_TR, Ref_BL, etc.,which are regions adjacent to the right and lower boundaries of thecurrent block, and then the right or lower boundary of the current blockmay be filled with the data. As an example, the right boundary may befilled by copying one of pixels such as T3, TR0, and TR1 as it is, orwith a value obtained by applying filtering to T3, TR0, and TR1.

Alternatively, data may be copied or derived from Ref_TL, Ref_T, Ref_L,Ref_TR, Ref_BL, etc., which are regions adjacent to the current block,and the bottom-right boundary of the current block may be filled withthe data. For example, a bottom-right boundary of the current block maybe filled with a value obtained based on one or more pixels in theadjacent region.

Here, the right boundary of the current block may be (d˜p) or (R0˜R3).The bottom boundary of the current block may be (m˜p) or (B0˜B3). Thebottom-right boundary of the current block may be one of p, BR, R3, andB3.

In the following example, it is assumed that the right boundary isR0˜R3, the bottom boundary is B0˜B3, and the bottom-right boundary isBR.

(Processing for Right Boundary and Bottom Boundary)

For example, the right boundary may be filled by copying one of T3, TR0,and TR1 adjacent to the vertical direction, and the bottom boundary maybe filled by copying one of L3, BL0, and BL1 adjacent to the horizontaldirection.

Alternatively, the right boundary may be filled with a weight averagevalue of T3, TR0, and TR1 adjacent to the vertical direction, and thebottom boundary may be filled with a weight average value of L3, BL0 andBL1 adjacent to the horizontal direction.

After obtaining values of the right boundary and the bottom boundary,intra prediction of the current block may be performed based on thevalues.

(Processing for Bottom-Right Boundary)

For example, the bottom-right border may be filled by copying one of T3,TR0, TR1, L3, BL0, and BL1. Alternatively, it may be filled with aweight average value of one of T3, TR0, and TR1 and one of L3, BL0, andBL1. Alternatively, it may be filled with one of a weight average valueof T3, TR0, and TR1 and a weight average value of L3, BL0, and BL1.Alternatively, it may be filled with a second weight average value of afirst weight average value of T3, TR0, and TR1 and a first weightaverage of L3, BL0, and BL1.

After obtaining the value of the bottom-right boundary, a value of theright boundary or the bottom boundary may be obtained based on thevalue, and intra prediction of the current block may be performed basedon the right boundary or the bottom boundary.

The following continues the description of the bottom-right boundaryprocessing.

Assume a configuration that considers the positions of TL, TR0, BL0, andBR. Here, BR may mean a pixel at the bottom-right boundary, TR0 may be areferenceable pixel located in the vertical direction of the BR, BL0 maybe a referenceable pixel located in the horizontal direction of the BR,and TL may be a referenceable pixel located at the top-left boundary ofthe current block or an intersection between the horizontal direction ofTR0 and the vertical direction of BL0.

Based on the pixel position, the directionality of the current block andfeature information (e.g., edge, etc.) may be estimated.

As an example <1>, the pixel value may gradually increase or decreasewhen moving diagonally from TL to BR. In this case, if TL is greaterthan or equal to TR0 and BL0, BR may be less than or equal to TR0 andBL0. Alternatively, it may be the opposite configuration.

As an example <2>, the pixel value may gradually increase or decreasewhen moving diagonally from BL0 to TR0. In this case, if BL0 is greaterthan or equal to TL and BR, TR0 may be less than or equal to TL and BR.Alternatively, it may be the opposite configuration.

As an example <3>, the pixel value may gradually increase or decreasewhen moving in the horizontal direction from the left (TL, BL0) to theright (TR0, BR). In this case, if TL is greater than or equal to TR0,BL0 may be greater than or equal to BR. Alternatively, it may be theopposite configuration.

As an example <4>, the pixel value may be gradually evidenced ordecreased when moving in the vertical direction from the top (TL, TR0)to the bottom (BL0, BR). In this case, if TL is greater than or equal toBL0, TR0 may be greater than or equal to BR. Alternatively, it may bethe opposite configuration.

If the image feature as in the above example exists in the currentblock, the bottom-right boundary may be predicted using this. In thiscase, a pixel located in the vertical or horizontal direction of theestimation target pixel and a pixel that is an intersection point in thevertical or horizontal direction of each pixel may be required, and theestimation target pixel may be predicted based on comparison of pixelvalues thereof.

<1> Example: When TL<=TR0 and TL<=BL0, the BR value may be derived(predicted) based on the difference between pixels by estimating thatthere is a tendency to increase from TL to BR.

For example, a BR pixel value may be derived by adding a value of(BL0-TL) to TR0 or by adding a value of (TR0-TL) to BL0. Alternatively,a BR pixel value may be derived by averaging or weight-averaging saidtwo values.

<2> Example: When TL>=BL0 and TL<=TR0, a BR value may be derived basedon the difference between pixels by estimating that there is a tendencyto increase from BL0 to TR0.

For example, a BR The pixel value may be derived by subtracting the(TL-BL0) value from TR0 or by adding the (TR0-TL) value to BL0.Alternatively, a BR pixel value may be derived by averaging orweight-averaging said two values.

In the above example, a case in which an arbitrary pixel BR is predictedby estimating a characteristic of a block based on a predetermined pixeladjacent to the current block has been described. Meanwhile, it may bedifficult to accurately seize the characteristics of a block due to thelimited pixel. For example, when an impulse component is present in someof the pixels referenced to induce the BR, it may be difficult toaccurately seize features.

To this end, characteristic information (e.g., variance, standarddeviation, etc.) of the top region and the left region of the currentblock may be calculated. As an example, if it is determined that thecharacteristic information of the pixels between TL and TR0 or thecharacteristic information of the pixels between TL and BL0 reflects theincrease or decrease of the block well, a method of deriving a value ofan arbitrary pixel such as BR based on the predetermined pixel of thecurrent block such as TL, TR0, BL0, etc. may be used.

The various embodiments of the disclosure are not intended to beall-inclusive and are intended to illustrate representative aspects ofthe disclosure, and the features described in the various embodimentsmay be applied independently or in a combination of two or more.

In addition, various embodiments of the present disclosure may beimplemented by hardware, firmware, software, or a combination thereof.In the case of hardware implementation, the hardware may be implementedby one or more application specific integrated circuits (ASICs), digitalsignal processors (DSPs), digital signal processing devices (DSPDs),programmable logic devices (PLDs), field programmable gate arrays(FPGAs), general processor, a controller, a micro-controller, amicro-processor, and the like.

The scope of the present disclosure includes a software ormachine-executable instructions (e.g., operating system, applications,firmware, program, etc.) which makes operations according to the methodsof the various embodiments be performed on the apparatus or computer anda non-transitory computer-readable medium, in which such software orinstructions are stored, executable on the apparatus or computer.

INDUSTRIAL AVAILABILITY

The present invention may be used to encode/decode a video signal.

The invention claimed is:
 1. A method of decoding an image based onintra prediction with a decoding apparatus, comprising: determining areference region for the intra prediction of a current block in theimage; selecting, based on prediction mode candidate group informationsignaled from a bitstream, one of a first prediction mode candidategroup and a second prediction mode candidate group, wherein a number ofintra prediction modes in the first prediction mode candidate group isdifferent from a number of intra prediction modes in the secondprediction mode candidate group; selecting, based on MPM information,one of a first candidate group, a second candidate group and a thirdcandidate group that are divided from the selected prediction modecandidate group; determining an intra prediction mode of the currentblock from the selected candidate group; and predicting the currentblock based on the determined intra prediction mode, wherein thereference region is spatially adjacent to the current block and includesat least one of a top reference region, a left reference region, atop-left reference region, a bottom-left reference region, or atop-right reference region, wherein determining the reference regioncomprises searching for whether an unavailable pixel exists in thereference region, wherein the search on the left reference region isperformed from top to bottom, wherein when the unavailable pixel isfound during the search on the left reference region, the unavailablepixel is replaced with a pixel above the unavailable pixel, and whereinthe first candidate group includes an intra prediction mode of aneighboring block adjacent to the current block, the second candidategroup includes an intra prediction mode with a diagonal direction and anintra prediction mode derived by adding or subtracting a predeterminedconstant to an index of the intra prediction mode of the neighboringblock, and the third candidate group includes remaining modes except forintra prediction modes in the first candidate group and the secondcandidate group among intra prediction modes belonging to the selectedprediction mode candidate group.
 2. The method of claim 1, wherein thecurrent block is obtained through a block division based on at least oneof a binary tree or a ternary tree, and wherein the binary tree isrepresentative of a division type of dividing one coding block into twocoding blocks, and the ternary tree is representative of a division typeof dividing one coding block into three coding blocks.
 3. The method ofclaim 1, wherein the reference region further includes at least one of aright reference region or a bottom-right reference region according to apredetermined coding order.
 4. The method of claim 1, wherein thepredetermined constant is a natural number greater than or equal to 5.5. A method of encoding an image based on intra prediction with anencoding apparatus, comprising: determining a reference region for theintra prediction of a current block in the image; selecting one of afirst prediction mode candidate group and a second prediction modecandidate group and encoding prediction mode candidate group informationindicating the selected prediction mode candidate group, wherein anumber of intra prediction modes in the first prediction mode candidategroup is different from a number of intra prediction modes in the secondprediction mode candidate group; and selecting one of a first candidategroup, a second candidate group and a third candidate group that aredivided from the selected prediction mode candidate group and encodingMPM information indicating the selected candidate group; predicting thecurrent block based on the reference region and an intra prediction modefrom the selected candidate group, wherein the reference region isspatially adjacent to the current block and includes at least one of atop reference region, a left reference region, a top-left referenceregion, a bottom-left reference region, or a top-right reference region,wherein determining the reference region comprises searching for whetheran unavailable pixel exists in the reference region, wherein the searchon the left reference region is performed from top to bottom, whereinwhen the unavailable pixel is found during the search on the leftreference region, the unavailable pixel is replaced with a pixel abovethe unavailable pixel, wherein the first candidate group includes anintra prediction mode of a neighboring bock adjacent to the currentblock, the second candidate group includes an intra prediction mode witha diagonal direction and an intra prediction mode derived by adding orsubtracting a predetermined constant to an index of the intra predictionmode of the neighboring block, and the third candidate group includesremaining modes except for intra prediction modes in the first candidategroup and the second candidate group among intra prediction modesbelonging to the selected prediction mode candidate group.
 6. Anon-transitory computer-readable storage medium having a bitstream thatis decoded by a method of decoding an image, wherein the bitstreamcomprises: prediction mode candidate group information indicating aprediction mode candidate group for decoding a block; MPM informationindicating a candidate group for decoding the block; wherein the methodcomprises: determining a reference region for the intra prediction of acurrent block in the image; selecting, based on the prediction modecandidate group information, one of a first prediction mode candidategroup and a second prediction mode candidate group, wherein a number ofintra prediction modes in the first prediction m candidate group isdifferent from a number of intra prediction modes in the secondprediction mode candidate group; selecting, based on the MPMinformation, one of a first candidate group a second candidate group anda third candidate group that are divided from the selected predictionmode candidate group; determining an intra prediction mode of thecurrent block from the selected candidate group; and predicting thecurrent block based on the determined intra prediction mode, wherein thereference region is spatially adjacent to the current block and includesat least one of a top reference region, a left reference region, atop-left reference region, a bottom-left reference region, or atop-right reference region, wherein determining the reference regioncomprises searching for whether an unavailable pixel exists in thereference region, wherein the search on the left reference region isperformed from top to bottom, wherein when the unavailable pixel isfound during the search on the left reference region, the unavailablepixel is replaced with a pixel above the unavailable pixel, and whereinthe first candidate group includes an intra prediction mode of aneighboring block adjacent to the current block, the second candidategroup includes an intra prediction mode with a diagonal direction and anintra prediction node derived by adding or subtracting a predeterminedconstant to an index of the infra prediction mode of the neighboringblock, and the third candidate group includes remaining modes except forintra prediction modes in the first candidate group and the secondcandidate group among infra prediction modes belonging to the selectedprediction mode candidate group.